Exemple #1
0
 void BeginWalk()
 {
     transform.localScale = Vector2.one; //Make big
     status = TroopStatus.Walk;
     anim.Play(walkHash);
     if (canStartStuckCheck)
     {
         StartCoroutine(StuckCheck()); //If stuck become ghost temporary
     }
 }
Exemple #2
0
    IEnumerator Attack()
    {
        transform.localScale = Vector2.one; //Make big
        move   = false;
        status = TroopStatus.Attack;
        atkPos = transform.position;
        anim.Play(attackHash);

        if (enemy != null)
        {
            while (enemy.health > 0 && status == TroopStatus.Attack && enemy)
            {
                enemy.health--;
                GetComponents <AudioSource>()[1].Play();
                yield return(new WaitForSeconds(0.5f));

                GetComponents <AudioSource>()[2].Play();
                yield return(new WaitForSeconds(0.5f));
            }
        }
        else if (enemyTower != null)
        {
            while (enemyTower.health > 0 && status == TroopStatus.Attack && enemyTower)
            {
                enemyTower.health--;
                List <Transform> troopsAtCite = enemyTower.GetComponentsInParent <BuildSiteController>()[0].GetTroops();
                foreach (Transform troop in troopsAtCite)
                {
                    troop.GetComponent <TroopController>().MakeObstacleMove(transform.position);
                }
                GetComponents <AudioSource>()[1].Play();
                yield return(new WaitForSeconds(1));
            }
        }

        EndAttack();
    }
Exemple #3
0
 void EndAttack()
 {
     status = TroopStatus.Nothing;
     move   = true;
 }
Exemple #4
0
 void BeginIdle()
 {
     transform.localScale = new Vector2(0.7f, 0.7f); //Make small
     status = TroopStatus.Idle;
     anim.Play(idleHash);
 }
Exemple #5
0
        public void SetStatus(TroopStatus ts)
        {
            this.status = ts;
            switch (ts)
            {
                case TroopStatus.一般:
                    this.CurrentTileAnimationKind = TileAnimationKind.无;
                    break;

                case TroopStatus.混乱:
                    this.CurrentTileAnimationKind = TileAnimationKind.混乱;
                    break;

                case TroopStatus.埋伏:
                    this.CurrentTileAnimationKind = TileAnimationKind.埋伏;
                    break;
            }
        }