Merge branch 'master' of https://github.com/new-00-0ne/System-Purge
This commit is contained in:
commit
9ddff14982
@ -10,10 +10,14 @@ public class Enemy : Controller{
|
||||
public LayerMask enemyMask;
|
||||
public bool rightdirection;
|
||||
public float[] time = new float[10];
|
||||
public bool idle;
|
||||
public bool wander;
|
||||
|
||||
// Use this for initialization
|
||||
void Start ()
|
||||
{
|
||||
time [0] = 2.0f;
|
||||
time [1] = 4.0f;
|
||||
print("start");
|
||||
mAnimator = GetComponent<Animator> ();
|
||||
changestate(new idle());
|
||||
|
@ -16,15 +16,22 @@ public class idle : state
|
||||
}
|
||||
public void Enter(Enemy enemy)
|
||||
{
|
||||
time = 0;
|
||||
Debug.Log("idle");
|
||||
this.enemy = enemy;
|
||||
enemy.idle = true;
|
||||
enemy.wander = false;
|
||||
}
|
||||
public void Exit(){}
|
||||
public void onTriggerEnter(Collider2D other){}
|
||||
public void Idle()
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
if (time >= enemy.time[0])
|
||||
if (time >= enemy.time [0]) {
|
||||
time = 0;
|
||||
enemy.idle = false;
|
||||
enemy.wander = true;
|
||||
enemy.changestate (new wander ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,12 @@ public class wander : state
|
||||
public void Execute()
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
if (time >= enemy.time[1])
|
||||
if (time >= enemy.time [1]) {
|
||||
time = 0;
|
||||
enemy.idle = true;
|
||||
enemy.wander = false;
|
||||
enemy.changestate (new idle ());
|
||||
}
|
||||
seeplayer();
|
||||
if (enemy.isAir)
|
||||
{
|
||||
@ -41,6 +45,9 @@ public class wander : state
|
||||
}
|
||||
public void Enter(Enemy enemy)
|
||||
{
|
||||
time = 0;
|
||||
enemy.wander = true;
|
||||
enemy.idle = false;
|
||||
Debug.Log("Wander");
|
||||
this.enemy = enemy;
|
||||
this.enemyMask = enemy.enemyMask;
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user