|
|
@@ -1,14 +1,24 @@
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using UnityEngine;
|
|
|
+using UnityEngine.InputSystem;
|
|
|
+public enum Trans_AssassinState
|
|
|
+{
|
|
|
+ None = -1,
|
|
|
+ Normal = 0, //正常状态
|
|
|
+ ReadyToRush = 1, //准备冲刺状态
|
|
|
+ Rush = 2, //冲刺状态
|
|
|
+ HaveRush = 3, //已冲刺一次状态
|
|
|
+ ReadyToSecondRush = 4, //第二次准备冲刺状态
|
|
|
+ SecondRush = 5, //第二次冲刺
|
|
|
+}
|
|
|
|
|
|
public class Trans_Assassin : MonoBehaviour
|
|
|
{
|
|
|
+
|
|
|
public PlayerController player;
|
|
|
public float criticalChance; //暴击率
|
|
|
public float criticalMultiplier; //暴击倍数
|
|
|
- public bool isUltimate;
|
|
|
- public bool isNextUltimate;
|
|
|
[HideInInspector]
|
|
|
public float distance;
|
|
|
public float rushSpeed;
|
|
|
@@ -20,6 +30,7 @@ public class Trans_Assassin : MonoBehaviour
|
|
|
[HideInInspector]
|
|
|
public float time;
|
|
|
public float nextRushTime;
|
|
|
+ public Trans_AssassinState state;
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
void Start()
|
|
|
@@ -30,52 +41,15 @@ public class Trans_Assassin : MonoBehaviour
|
|
|
player.criticalMultiplier = criticalMultiplier;
|
|
|
distance = rushSpeed * rushTime/2;
|
|
|
}
|
|
|
-
|
|
|
// Update is called once per frame
|
|
|
void Update()
|
|
|
{
|
|
|
- if (isNextUltimate)
|
|
|
+ switch (state)
|
|
|
{
|
|
|
-
|
|
|
- if (isUltimate)
|
|
|
- {
|
|
|
-
|
|
|
- if (player.isUltimate)
|
|
|
- {
|
|
|
- ReadyToDash(player.moveVec);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- dashEffect.canHit = true;
|
|
|
- aimEffect.SetActive(false);
|
|
|
- player.ani.Play("attack_summon", 0, 0);
|
|
|
- Rush();
|
|
|
- time += Time.deltaTime;
|
|
|
- if (time >= rushTime)
|
|
|
- {
|
|
|
- //isNextUltimate = true;
|
|
|
- //isUltimate = false;
|
|
|
-
|
|
|
- player.canMove = true;
|
|
|
- player.canfly = false;
|
|
|
- dashEffect.canHit = false;
|
|
|
- player.bodyTrans.rotation = Quaternion.Euler(Vector3.zero);
|
|
|
- player.ChangeState(CharacterState.Fall);
|
|
|
- time = 0;
|
|
|
- player.EndTransfiguration(4);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- time += Time.deltaTime;
|
|
|
- if (time >= nextRushTime)
|
|
|
- {
|
|
|
- player.EndTransfiguration(4);
|
|
|
- }
|
|
|
+ case Trans_AssassinState.Normal:
|
|
|
if (player.isUltimate)
|
|
|
{
|
|
|
- time = 0;
|
|
|
+ player.isUltimate = false;
|
|
|
player.moveVec = player.leftDir;
|
|
|
player.canMove = false;
|
|
|
player.ChangeState(CharacterState.None);
|
|
|
@@ -90,44 +64,47 @@ public class Trans_Assassin : MonoBehaviour
|
|
|
aimEffect.SetActive(true);
|
|
|
aimEffect.transform.localScale =
|
|
|
new Vector3(distance, 3, 1);
|
|
|
- isUltimate = true;
|
|
|
+ state = Trans_AssassinState.ReadyToRush;
|
|
|
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (isUltimate)
|
|
|
- {
|
|
|
-
|
|
|
- if (player.isUltimate)
|
|
|
+ break;
|
|
|
+ case Trans_AssassinState.ReadyToRush:
|
|
|
+ ReadyToDash(player.moveVec);
|
|
|
+ if (player.keyTransfigurateRelease)
|
|
|
{
|
|
|
- ReadyToDash(player.moveVec);
|
|
|
+ player.keyTransfigurateRelease = false;
|
|
|
+ state = Trans_AssassinState.Rush;
|
|
|
+ time = 0;
|
|
|
}
|
|
|
- else
|
|
|
+ break;
|
|
|
+ case Trans_AssassinState.Rush:
|
|
|
+ dashEffect.canHit = true;
|
|
|
+ aimEffect.SetActive(false);
|
|
|
+ player.ani.Play("attack_summon", 0, 0);
|
|
|
+ Rush();
|
|
|
+ time += Time.deltaTime;
|
|
|
+ if (time >= rushTime)
|
|
|
{
|
|
|
- dashEffect.canHit = true;
|
|
|
- aimEffect.SetActive(false);
|
|
|
- player.ani.Play("attack_summon", 0, 0);
|
|
|
- Rush();
|
|
|
- time += Time.deltaTime;
|
|
|
- if (time >= rushTime)
|
|
|
- {
|
|
|
- isNextUltimate = true;
|
|
|
- isUltimate = false;
|
|
|
- player.canMove = true;
|
|
|
- player.canfly = false;
|
|
|
- dashEffect.canHit = false;
|
|
|
- player.bodyTrans.rotation = Quaternion.Euler(Vector3.zero);
|
|
|
- player.ChangeState(CharacterState.Fall);
|
|
|
- time = 0;
|
|
|
- }
|
|
|
+ player.canMove = true;
|
|
|
+ player.canfly = false;
|
|
|
+ dashEffect.canHit = false;
|
|
|
+ player.bodyTrans.rotation = Quaternion.Euler(Vector3.zero);
|
|
|
+ player.ChangeState(CharacterState.Fall);
|
|
|
+ time = 0;
|
|
|
+ state = Trans_AssassinState.HaveRush;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case Trans_AssassinState.HaveRush:
|
|
|
+ time += Time.deltaTime;
|
|
|
+ if (time >= nextRushTime)
|
|
|
+ {
|
|
|
+ player.EndTransfiguration(4);
|
|
|
+ break;
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
if (player.isUltimate)
|
|
|
{
|
|
|
+ player.isUltimate = false;
|
|
|
+ time = 0;
|
|
|
player.moveVec = player.leftDir;
|
|
|
player.canMove = false;
|
|
|
player.ChangeState(CharacterState.None);
|
|
|
@@ -135,17 +112,42 @@ public class Trans_Assassin : MonoBehaviour
|
|
|
player.canfly = true;
|
|
|
if (!player.foot.TrigGround)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
player.rb.velocity = Vector3.zero;
|
|
|
player.rb.useGravity = false;
|
|
|
}
|
|
|
aimEffect.SetActive(true);
|
|
|
aimEffect.transform.localScale =
|
|
|
new Vector3(distance, 3, 1);
|
|
|
- isUltimate = true;
|
|
|
-
|
|
|
+ state = Trans_AssassinState.ReadyToSecondRush;
|
|
|
}
|
|
|
- }
|
|
|
+ break;
|
|
|
+ case Trans_AssassinState.ReadyToSecondRush:
|
|
|
+ ReadyToDash(player.moveVec);
|
|
|
+ if (player.keyTransfigurateRelease)
|
|
|
+ {
|
|
|
+ player.keyTransfigurateRelease = false;
|
|
|
+ state = Trans_AssassinState.SecondRush;
|
|
|
+ time = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case Trans_AssassinState.SecondRush:
|
|
|
+ dashEffect.canHit = true;
|
|
|
+ aimEffect.SetActive(false);
|
|
|
+ player.ani.Play("attack_summon", 0, 0);
|
|
|
+ Rush();
|
|
|
+ time += Time.deltaTime;
|
|
|
+ if (time >= rushTime)
|
|
|
+ {
|
|
|
+ player.canMove = true;
|
|
|
+ player.canfly = false;
|
|
|
+ dashEffect.canHit = false;
|
|
|
+ player.bodyTrans.rotation = Quaternion.Euler(Vector3.zero);
|
|
|
+ player.ChangeState(CharacterState.Fall);
|
|
|
+ time = 0;
|
|
|
+ player.EndTransfiguration(4);
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -154,21 +156,27 @@ public class Trans_Assassin : MonoBehaviour
|
|
|
{
|
|
|
player.criticalChance = 0;
|
|
|
player.jumpNumber = 2;
|
|
|
+ player.bodyTrans.transform.localScale = transform.GetChild(0).localScale;
|
|
|
}
|
|
|
public void ReadyToDash(Vector2 leftDir)
|
|
|
{
|
|
|
if(leftDir == Vector2.zero)
|
|
|
{
|
|
|
- if (player.transform.localScale.x > 0)
|
|
|
- {
|
|
|
- targetDir = Vector3.right;
|
|
|
- }
|
|
|
- else
|
|
|
+ if (targetDir == Vector3.zero)
|
|
|
{
|
|
|
- targetDir = Vector3.left;
|
|
|
-
|
|
|
+ if (transform.GetChild(0).localScale.x < 0)
|
|
|
+ {
|
|
|
+ targetDir = Vector3.right;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ targetDir = Vector3.left;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|