Exemple #1
0
    void CheckFollow()
    {
        if (followOrder > 5)
        {
            currentState = ZombieState.Dead;
            return;
        }

        float distance = (target.position - transform.position).magnitude;

        if (distance < followDistance)
        {
            zombieManager.AddFollowList(gameObject);
            int randOrder = Random.Range(1, 5);
            SetFollowOrder(randOrder);
            if (followOrder == 1)
            {
                attackTime   = 0;
                currentState = ZombieState.Attack;
            }
            else
            {
                currentState = ZombieState.Follow;
            }
        }
    }