示例#1
0
    IEnumerator PlayDead(BaseDuckling DuckBody)
    {
        DuckBody.myAnimator.SetBool("IsShot", true);
        yield return(new WaitForSeconds(time));

        DuckBody.myAnimator.SetBool("IsShot", false);

        DuckBody.StopCoroutine(PlayDead(DuckBody));
        DuckBody.currentHealth = 1;
        DuckBody.speed         = 2;
        DuckBody.ChangeState("fly");
        DuckBody.transform.gameObject.SetActive(false);
    }
示例#2
0
    public override void OnUpdate(BaseDuckling duckling)
    {
        if (duckling.currentHealth <= 0)
        {
            duckling.ChangeState("dead");
        }

        //Check if you are at target position
        if (duckling.transform.position.x == duckling.targets[myTarget].transform.position.x)
        {
            if (duckling.transform.position.y == duckling.targets[myTarget].transform.position.y)
            {
                //if so then go to new target posiiton
                myTarget = Random.Range(0, duckling.targets.Count);
            }
        }
        //move towards your current target if you are not dead
        currentTarget = new Vector2(duckling.targets[myTarget].transform.position.x, duckling.targets[myTarget].transform.position.y);
        duckling.transform.position = Vector2.MoveTowards(duckling.transform.position, currentTarget, mySpeed * Time.deltaTime);
    }
示例#3
0
 public override void OnEnter(BaseDuckling duckling)
 {
     duckling.StartCoroutine(PlayDead(duckling));
 }
示例#4
0
 public override void OnUpdate(BaseDuckling duckling)
 {
 }
示例#5
0
 public override void OnExit(BaseDuckling duckling)
 {
 }
示例#6
0
 public override void OnExit(BaseDuckling duckling)
 {
     mySpeed = 0;
 }
示例#7
0
 public override void OnEnter(BaseDuckling duckling)
 {
     myTarget = Random.Range(0, duckling.targets.Count);
     mySpeed  = duckling.speed;
 }
示例#8
0
 public abstract void OnExit(BaseDuckling duckling);
示例#9
0
 public abstract void OnUpdate(BaseDuckling duckling);
示例#10
0
 public abstract void OnEnter(BaseDuckling duckling);