Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        StateSetter();
        switch (charaState)
        {
        case States.Moving:
            if (enemy && Vector2.Distance(transform.position, enemy.transform.position) <= chara.Vision && !enemy.IsDead)
            {
                CharacterCommands.SetPath(chara, enemy.transform.position);
            }
            else if (target)
            {
                CharacterCommands.SetPath(chara, target.position);
            }
            break;

        case States.Attacking:
            AttackState();
            break;

        case States.Eating:
            EatState();
            break;

        case States.Seeking:
            SeekState();
            break;

        default:
            break;
        }
    }
Beispiel #2
0
 void MoveState(Transform _target)
 {
     CharacterCommands.SetPath(chara, _target.position);
 }