private IEnumerator timeForAction() { if (actionStarted) { yield break; } actionStarted = true; //animate the enemy to attack hero Vector3 heroPos = hero.transform.position; while (moveTowardsEnemy(heroPos)) { yield return(null); } //wait yield return(new WaitForSeconds(.5f)); //do damage myAction.doAttack(battle.heroes[0]); //animate to start position Vector3 firstPos = startPos; while (moveTowardsStart(firstPos)) { yield return(null); } //remove from list in battlestatemachine battle.list.RemoveAt(0); //reset battlestatemachine to wait battle.battleState = BattleStateMachine.performAction.WAIT; //end it actionStarted = false; cur_cooldown = 0f; currentState = TurnState.PROCESSING; }
public void Input1() //attackButton { heroChoice.Attacker = heroesToManage[0].name; heroChoice.attacksGameObject = heroesToManage[0]; heroChoice.Type = "Hero"; //ActionList.SetActive(false); gameManager.GetComponent <GameStates>().List.SetActive(false); heroChoice.attackersTarget = enemies[0]; myAction.doAttack(enemies[0]); heroInput = heroGUI.DONE; }