// Start is called before the first frame update void Start() { g = DataManagement.instance.player; //always start in start currState = stateOfBattle.START; displayCombatantInfo(); setUPUI(); /* * * playerTurn = true; * enemTurn = false; * endCombat = false; */ loc = g.location; //set up the background //nesw if (loc == 1) { bgImg.GetComponentInChildren <Image>().sprite = Resources.Load <Sprite>("Art/Northern Background"); } else if (loc == 2) { bgImg.GetComponentInChildren <Image>().sprite = Resources.Load <Sprite>("Art/Eastern Background"); } else if (loc == 3) { bgImg.GetComponentInChildren <Image>().sprite = Resources.Load <Sprite>("Art/Southern Background"); } else if (loc == 4) { bgImg.GetComponentInChildren <Image>().sprite = Resources.Load <Sprite>("Art/Western Background"); } else if (loc == 0) { //set up the final battle bg } else { bgImg.GetComponentInChildren <Image>().sprite = Resources.Load <Sprite>("Art/Northern Background"); } }
public void isDead() { //if player has lost, set state to appropriate if (g.attributes[0] <= 0) { //lose, and set location to 0 g.location = 0; currState = stateOfBattle.LOSE; } if (enemy.GetComponent <wolfScript>().dead() == true && !finalVictory && finalFight) { currState = stateOfBattle.FFIGHT1; } if (enemy.GetComponent <wolfScript>().dead() == true && finalVictory && !finalFight) { currState = stateOfBattle.NFFIGHT; } }
//decide order of events public void next() { //start of battle becomes player turn if (currState == stateOfBattle.START) { //whenever its the start of the players turn set the player defense mod to 0 playerDefenseMod = 0; currState = stateOfBattle.PLAYERCH; } //enemy turn, then turns into player turn else if (currState == stateOfBattle.ENEMCH) { //whenever its the start of the players turn set the player defense mod to 0 playerDefenseMod = 0; currState = stateOfBattle.PLAYERCH; } //player turn turns into enemy turn else if (currState == stateOfBattle.PLAYERCH) { //the player has made their choice and the canvas displaying the information that their choice has made comes up writeDMG(); currState = stateOfBattle.STANDBY; } else if (currState == stateOfBattle.STANDBY) { //whenever the wolf has its turn its defense buff is always reset enemDefenseMod = 0; enemyDecision(); currState = stateOfBattle.ENEMCH; } //set up the battle here setUPUI(); //always dsiplay the combatant info no matter where you are displayCombatantInfo(); }