Ejemplo n.º 1
0
    private void EnemyStateMachine()
    {
        switch (activeState)
        {
        case EnemyState.IDLE:
        {
            break;
        }

        case EnemyState.COMBAT:
        {
            break;
        }

        case EnemyState.PATROL:
        {
            if (nav.GetStopped())
            {
                target = patrol.GetNewWaipoint(target);
                nav.SetDestination(target);
            }
            break;
        }

        case EnemyState.HOLD:
        {
            break;
        }

        case EnemyState.RETURNING_TO_POSITION:
        {
            if (nav.GetStopped())
            {
                if (FaceAndCheckObjective(hold.DirectionToFace(), 2f))
                {
                    activeState = EnemyState.HOLD;
                }
                else
                {
                    FaceObjective(hold.DirectionToFace());
                }
            }
            break;
        }

        default:
        {
            break;
        }
        }
    }
Ejemplo n.º 2
0
 private void Start()
 {
     if (!staticEnemy)
     {
         ActiveState = SkeletonState.PATROL;
         target      = patrol.GetNewWaipoint(new Vector3(Mathf.Infinity, Mathf.Infinity, Mathf.Infinity));
         nav.SetDestination(target);
     }
     else
     {
         ActiveState = SkeletonState.RETURNING_TO_POSITION;
         target      = hold.ReturnToPosition();
         nav.SetDestination(target);
     }
     angularSpeedBase = nav.angularSpeed;
     nextAtack        = attackList.GetNextAttack();
     destructionTime += Random.value * destructionTime; //randomice the destrucction time;
 }