Beispiel #1
0
    void Update()
    {
        // Move toward the closest food
        Transform target = FoodManager.GetClosestFood(this.transform);

        if (target != null)
        {
            if (this.AnimBehavior.clip != this.RunClip)
            {
                this.AnimBehavior.Stop();
                this.AnimBehavior.clip = this.RunClip;
                this.AnimBehavior.Play();
            }

            _moveUpdate(target);
        }
        else if (this.AnimBehavior.clip != this.IdleClip)
        {
            this.AnimBehavior.Stop();
            this.AnimBehavior.clip = this.IdleClip;
            this.AnimBehavior.Play();
        }
    }