// Update is called once per frame void Update() { switch (battleStates) { case (PerformAction.WAIT): if (PerformList.Count > 0) { battleStates = PerformAction.TAKEACTION; } break; case (PerformAction.TAKEACTION): GameObject performer = GameObject.Find(PerformList[0].Attacker); if (PerformList[0].Type == "enemy") { EnemyStateMachine ESM = performer.GetComponent <EnemyStateMachine>(); ESM.WolfToAttack = PerformList[0].AttackersTarget; ESM.currentState = EnemyStateMachine.TurnState.ACTION; } if (PerformList[0].Type == "wolf") { WolfStateMachine HSM = performer.GetComponent <WolfStateMachine>(); HSM.EnemyToAttack = PerformList[0].AttackersTarget; HSM.currentState = WolfStateMachine.TurnState.ACTION; } battleStates = PerformAction.PERFORMACTION; break; case (PerformAction.PERFORMACTION): //idle break; } switch (WolfInput) { case (WolfGUI.ACTIVATE): { if (WolvesToManage.Count > 0) { WolvesToManage[0].transform.FindChild("selector").gameObject.SetActive(true); //Indicator appears in-game WolfChoice = new HandleTurns(); AttackPanel.SetActive(true); //Right grey attack panel appears WolfInput = WolfGUI.WAITING; //Idle state for Wolf Input } break; } case (WolfGUI.WAITING): { //idling break; } case (WolfGUI.DONE): { WolfInputDone(); break; } } }
void WolfInputDone() { PerformList.Add(WolfChoice); //Command sent to BSM list of commands EnemySelectPanel.SetActive(false); WolvesToManage[0].transform.FindChild("selector").gameObject.SetActive(false); //Indicator disappears in-game WolvesToManage.RemoveAt(0); //Cycle into the next wolf's input handling WolfInput = WolfGUI.ACTIVATE; }
// Use this for initialization void Start() { battleStates = PerformAction.WAIT; WolvesInBattle.AddRange(GameObject.FindGameObjectsWithTag("wolf")); EnemiesInBattle.AddRange(GameObject.FindGameObjectsWithTag("enemy")); WolfInput = WolfGUI.ACTIVATE; AttackPanel.SetActive(false); EnemySelectPanel.SetActive(false); EnemyButtons(); }
public void Input2(GameObject chosenEnemy) //Enemy selection { WolfChoice.AttackersTarget = chosenEnemy; WolfInput = WolfGUI.DONE; }