Esempio n. 1
0
 public void Stop()
 {
     if (currentMovement != null)
     {
         currentMovement.Cancel();
         currentMovement = null;
     }
 }
Esempio n. 2
0
 public void LoadMovements(EnemyConfig config)
 {
     speed = config.speed;
     secondaryMovementFrequency = config.secondaryMovementFrequency;
     mainMovement       = config.mainMovement.CreateMovement(gameObject);
     secondaryMovements = new List <EnemyMovementLogic>();
     foreach (EnemyMovementType movementType in config.secondayMovements)
     {
         secondaryMovements.Add(movementType.CreateMovement(gameObject));
     }
 }
Esempio n. 3
0
        private void Move()
        {
            if (currentSteps == secondaryMovementFrequency && secondaryMovements.Count > 0)
            {
                currentSteps = 0;
                int secondaryIndex = Random.Range(0, secondaryMovements.Count);
                currentMovement = secondaryMovements[secondaryIndex];
            }
            else
            {
                currentMovement = mainMovement;
            }
            bool valid = currentMovement.Move(speed, OnMovementFinished, projectionPool);

            if (!valid)
            {
                StartCoroutine(WaitAndTryToMoveAgain());
            }
        }