public void LearnNewMove() { for (int i = 0; i < learnableMoves.Length; i++) //loop through all learnable moves { if (learnableMoves[i].GetLearnAt() <= lvl && !learnt[i]) //if your highenough level to learn the move and haven't leant it { for (int ii = 0; ii < 4; ii++) //find empty slot in moves { if (moves[ii] == null) { moves[ii] = new PartyMove(learnableMoves[i]); //set slot to move learnt[i] = true; break; //don't fill all slots } }// add outcome for if all slots are full } } }
void InitializeStateMachine() { stateMachine = new StateMachine(null); PartyMove tmpmove = new PartyMove(stateMachine, this); PartyGuard tmpguard = new PartyGuard(stateMachine, this, guardTime); PartyIdle tmpidle = new PartyIdle(stateMachine, this); PartyAttack tmpattack = new PartyAttack(stateMachine, waitBeforeNextAttack, this); PartyConquer tmpconquer = new PartyConquer(stateMachine, 15f, this); tmpattack.SetTransition(tmpguard); tmpmove.SetTransition(tmpguard); tmpguard.SetTransition(tmpidle, tmpattack); tmpidle.SetTransition(tmpmove, tmpconquer); tmpconquer.SetTransition(tmpidle); move = tmpmove; guard = tmpguard; idle = tmpidle; attack = tmpattack; conquer = tmpconquer; stateMachine.ChangeIdleState(idle); }