|
@@ -35,6 +35,7 @@ public class Enemy : MoveCharacter
|
|
|
|
|
|
|
|
public Character targetCharacter;
|
|
public Character targetCharacter;
|
|
|
public float attackRatio;
|
|
public float attackRatio;
|
|
|
|
|
+ public float maxMoveSpeed, minMoveSpeed;
|
|
|
|
|
|
|
|
private void Awake()
|
|
private void Awake()
|
|
|
{
|
|
{
|
|
@@ -49,6 +50,7 @@ public class Enemy : MoveCharacter
|
|
|
public override void Init()
|
|
public override void Init()
|
|
|
{
|
|
{
|
|
|
base.Init();
|
|
base.Init();
|
|
|
|
|
+ moveSpeed = Random.Range(minMoveSpeed, maxMoveSpeed);
|
|
|
ChangeSearchState(SearchState.NoTarget);
|
|
ChangeSearchState(SearchState.NoTarget);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -183,7 +185,7 @@ public class Enemy : MoveCharacter
|
|
|
if (leftDir.x > 0.3f)
|
|
if (leftDir.x > 0.3f)
|
|
|
{
|
|
{
|
|
|
//rb.velocity += Vector3.right * moveAcc * Time.deltaTime;
|
|
//rb.velocity += Vector3.right * moveAcc * Time.deltaTime;
|
|
|
- rb.velocity = Vector3.right * maxMoveSpeed;
|
|
|
|
|
|
|
+ rb.velocity = Vector3.right * moveSpeed;
|
|
|
//if (rb.velocity.x > maxMoveSpeed)
|
|
//if (rb.velocity.x > maxMoveSpeed)
|
|
|
//{
|
|
//{
|
|
|
// rb.velocity = new Vector3(maxMoveSpeed, rb.velocity.y, rb.velocity.z);
|
|
// rb.velocity = new Vector3(maxMoveSpeed, rb.velocity.y, rb.velocity.z);
|
|
@@ -196,7 +198,7 @@ public class Enemy : MoveCharacter
|
|
|
else if (leftDir.x < -0.3f)
|
|
else if (leftDir.x < -0.3f)
|
|
|
{
|
|
{
|
|
|
//rb.velocity -= Vector3.right * moveAcc * Time.deltaTime;
|
|
//rb.velocity -= Vector3.right * moveAcc * Time.deltaTime;
|
|
|
- rb.velocity = Vector3.left * maxMoveSpeed;
|
|
|
|
|
|
|
+ rb.velocity = Vector3.left * moveSpeed;
|
|
|
//if (rb.velocity.x < -maxMoveSpeed)
|
|
//if (rb.velocity.x < -maxMoveSpeed)
|
|
|
//{
|
|
//{
|
|
|
// rb.velocity = new Vector3(-maxMoveSpeed, rb.velocity.y, rb.velocity.z);
|
|
// rb.velocity = new Vector3(-maxMoveSpeed, rb.velocity.y, rb.velocity.z);
|