|
@@ -12,7 +12,7 @@ public class ESpirits_KiteNinja : Enemy
|
|
|
[LabelText("复活次数")] public int revivesNum;
|
|
[LabelText("复活次数")] public int revivesNum;
|
|
|
[LabelText("复活范围")] public Vector2 revivesPos;
|
|
[LabelText("复活范围")] public Vector2 revivesPos;
|
|
|
[LabelText("逃跑距离")] public float fleeDistance;
|
|
[LabelText("逃跑距离")] public float fleeDistance;
|
|
|
- [LabelText("逃跑速度比例")] public float fleeSpeedRate;
|
|
|
|
|
|
|
+ [LabelText("逃跑速度比例")] public Vector2 fleeSpeedRate;
|
|
|
public bool targetIsPlayer;
|
|
public bool targetIsPlayer;
|
|
|
public int lockingNum;
|
|
public int lockingNum;
|
|
|
private PlayerController player;
|
|
private PlayerController player;
|
|
@@ -20,6 +20,7 @@ public class ESpirits_KiteNinja : Enemy
|
|
|
public override void Init()
|
|
public override void Init()
|
|
|
{
|
|
{
|
|
|
base.Init();
|
|
base.Init();
|
|
|
|
|
+ rb.constraints = RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotation;
|
|
|
targetIsPlayer = true;
|
|
targetIsPlayer = true;
|
|
|
lockingNum = 0;
|
|
lockingNum = 0;
|
|
|
player = PlayersInput.instance[0];
|
|
player = PlayersInput.instance[0];
|
|
@@ -61,16 +62,28 @@ public class ESpirits_KiteNinja : Enemy
|
|
|
Turn();
|
|
Turn();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ Vector3 velocity = rb.velocity;
|
|
|
if (Mathf.Abs(distance) < fleeDistance)
|
|
if (Mathf.Abs(distance) < fleeDistance)
|
|
|
{
|
|
{
|
|
|
- Vector3 velocity = Vector3.right * moveSpeed * fleeSpeedRate;
|
|
|
|
|
|
|
+ velocity = new Vector3(moveSpeed * fleeSpeedRate.x,moveSpeed * fleeSpeedRate.y,0);
|
|
|
if (distance > 0)
|
|
if (distance > 0)
|
|
|
{
|
|
{
|
|
|
velocity.x = -velocity.x;
|
|
velocity.x = -velocity.x;
|
|
|
}
|
|
}
|
|
|
- rb.velocity = velocity * moveSpeedScale;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ if(transform.position.y > flyHeight)
|
|
|
|
|
+ {
|
|
|
|
|
+ velocity.y = moveSpeed * fleeSpeedRate.y;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ velocity.y = 0;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ rb.velocity = velocity * moveSpeedScale;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
base.OnState();
|
|
base.OnState();
|