void BeginWalk() { transform.localScale = Vector2.one; //Make big status = TroopStatus.Walk; anim.Play(walkHash); if (canStartStuckCheck) { StartCoroutine(StuckCheck()); //If stuck become ghost temporary } }
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(); }
void EndAttack() { status = TroopStatus.Nothing; move = true; }
void BeginIdle() { transform.localScale = new Vector2(0.7f, 0.7f); //Make small status = TroopStatus.Idle; anim.Play(idleHash); }
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; } }