public void BackTrack()
 {
     if (alienTargetPath.Count > 1)
     {
         Debug.Log("Backtracking??");
         //do something
         int lastIndex = alienTargetPath.Count - 1;
         currentAlienTarget.OnLostControl();
         currentAlienTarget = alienTargetPath[lastIndex - 1];
         currentAlienTarget.OnControlled();
         alienTargetPath.RemoveAt(lastIndex);
     }
 }
/*
 *      public void BackTrack(AlienTarget backtrackTarget) {
 *              this.backtrackTarget = backtrackTarget;
 *              iTween.MoveTo(this.gameObject,
 *                      new ITweenBuilder()
 *                              .SetPosition(backtrackTarget.transform.position)
 *                              .SetSpeed(3f)
 *                              .SetOnCompleteTarget(this.gameObject)
 *                              .SetOnComplete("OnBacktrackingComplete").Build());
 *      }
 *
 *      private void OnBacktrackingComplete() {
 *              SceneUtils.FindObject<AlienTargetManager>().SwitchAlien(backtrackTarget);
 *              Destroy(this.gameObject);
 *      }
 */

    public void OnAlienTargetHit(AlienTarget alienTarget)
    {
        alienTargetPath.Add(alienTarget);
        alienTargetsVisited.Add(alienTarget);
        currentAlienTarget = alienTarget;

        targetsHit++;
        Debug.Log("hit " + targetsHit + " aliens");
        alienUIManager.OnEnemyHit(alienTarget.alienTargetType);
        if (targetsHit >= requiredAliensToHit)
        {
            if (!canExplodeAllEnemies)
            {
                alienGameManager.PlayExplodeUnlockedSound();
                alienUIManager.OnExplodeUnlocked();
                OnCanExplodeEnemies();
            }
            canExplodeAllEnemies = true;
        }
        else
        {
            alienGameManager.PlayEnemyHitSound();
        }
    }
Exemplo n.º 3
0
 private void FindTarget()
 {
     target = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <AlienTarget>();
 }