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 LayerMask enemyMask;
|
||||||
public bool rightdirection;
|
public bool rightdirection;
|
||||||
public float[] time = new float[10];
|
public float[] time = new float[10];
|
||||||
|
public bool idle;
|
||||||
|
public bool wander;
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start ()
|
void Start ()
|
||||||
{
|
{
|
||||||
|
time [0] = 2.0f;
|
||||||
|
time [1] = 4.0f;
|
||||||
print("start");
|
print("start");
|
||||||
mAnimator = GetComponent<Animator> ();
|
mAnimator = GetComponent<Animator> ();
|
||||||
changestate(new idle());
|
changestate(new idle());
|
||||||
|
@ -16,15 +16,22 @@ public class idle : state
|
|||||||
}
|
}
|
||||||
public void Enter(Enemy enemy)
|
public void Enter(Enemy enemy)
|
||||||
{
|
{
|
||||||
|
time = 0;
|
||||||
Debug.Log("idle");
|
Debug.Log("idle");
|
||||||
this.enemy = enemy;
|
this.enemy = enemy;
|
||||||
|
enemy.idle = true;
|
||||||
|
enemy.wander = false;
|
||||||
}
|
}
|
||||||
public void Exit(){}
|
public void Exit(){}
|
||||||
public void onTriggerEnter(Collider2D other){}
|
public void onTriggerEnter(Collider2D other){}
|
||||||
public void Idle()
|
public void Idle()
|
||||||
{
|
{
|
||||||
time += Time.deltaTime;
|
time += Time.deltaTime;
|
||||||
if (time >= enemy.time[0])
|
if (time >= enemy.time [0]) {
|
||||||
enemy.changestate(new wander());
|
time = 0;
|
||||||
|
enemy.idle = false;
|
||||||
|
enemy.wander = true;
|
||||||
|
enemy.changestate (new wander ());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,12 @@ public class wander : state
|
|||||||
public void Execute()
|
public void Execute()
|
||||||
{
|
{
|
||||||
time += Time.deltaTime;
|
time += Time.deltaTime;
|
||||||
if (time >= enemy.time[1])
|
if (time >= enemy.time [1]) {
|
||||||
enemy.changestate(new idle());
|
time = 0;
|
||||||
|
enemy.idle = true;
|
||||||
|
enemy.wander = false;
|
||||||
|
enemy.changestate (new idle ());
|
||||||
|
}
|
||||||
seeplayer();
|
seeplayer();
|
||||||
if (enemy.isAir)
|
if (enemy.isAir)
|
||||||
{
|
{
|
||||||
@ -41,6 +45,9 @@ public class wander : state
|
|||||||
}
|
}
|
||||||
public void Enter(Enemy enemy)
|
public void Enter(Enemy enemy)
|
||||||
{
|
{
|
||||||
|
time = 0;
|
||||||
|
enemy.wander = true;
|
||||||
|
enemy.idle = false;
|
||||||
Debug.Log("Wander");
|
Debug.Log("Wander");
|
||||||
this.enemy = enemy;
|
this.enemy = enemy;
|
||||||
this.enemyMask = enemy.enemyMask;
|
this.enemyMask = enemy.enemyMask;
|
||||||
|
Binary file not shown.
Reference in New Issue
Block a user