public void CheckIfBattleOver() { if (player.health <= 0) { battleState = BattleStates.EndBattle; donkey.gameObject.GetComponent <informationDonkey>().setPlayerHealth(0); donkey.gameObject.GetComponent <informationDonkey>().playerWon = false; donkey.gameObject.GetComponent <informationDonkey>().goToOverworld(); //GameObject gm = GameObject.FindGameObjectWithTag("GameManager"); //gm.GetComponent<GameManager>().playerHealth = player.GetComponent<PlayerBattle>().health; //gm.GetComponent<GameManager>().goToOverworld(); // GameObject donkey = Game } if (enemyDestroyed) { battleState = BattleStates.EndBattle; donkey.gameObject.GetComponent <informationDonkey>().setPlayerHealth(player.GetComponent <PlayerBattle>().health); donkey.gameObject.GetComponent <informationDonkey>().playerWon = true; donkey.gameObject.GetComponent <informationDonkey>().enemiesKilled++; donkey.gameObject.GetComponent <informationDonkey>().goToOverworld(); } if (player.gridPos.position.x == 0 || player.gridPos.position.x == TerrainManager.Instance.length - 1) { donkey.gameObject.GetComponent <informationDonkey>().setPlayerHealth(player.GetComponent <PlayerBattle>().health); battleState = BattleStates.EndBattle; donkey.gameObject.GetComponent <informationDonkey>().goToOverworld(); } }
void OnGUI() { if (GUILayout.Button("NEXT STATE")) { if (currentState == BatteStates.START) { currentState = BatteStates.PLAYERCHOICE; } else if (currentState == BatteStates.PLAYERCHOICE) { currentState = BatteStates.ENEMYCHOICE; } else if (currentState == BatteStates.ENEMYCHOICE) { currentState = BatteStates.LOSE; } else if (currentState == BatteStates.LOSE) { currentState = BatteStates.WIN; } else if (currentState == BatteStates.WIN) { currentState = BatteStates.START; } } }
public static BattleStates currentActor; //uma instância de BattleStates apenas para armazenar quem está agindo // Start is called before the first frame update void Start() { Cursor.lockState = CursorLockMode.None; Cursor.visible = true; inimigoTerminouTurno = false; jogadorTerminouTurno = false; playerCamera.enabled = true; // Torna a camera ativa a do Jogador, por padrão, ao começar a batalha enemyActionCamera.enabled = false; // battleResultsPanel.SetActive(false); // jogPassouNivel = false; // desativam o aviso no começo da cena lvlupwarnTxt.SetActive(false); // inimigosList = new List <Inimigo>(); inimObjList = new List <GameObject>(); waitActive = false; waitTime = startWaitTime; xprecebido = false; totalRoundCounter = 1; SetEnemies(); //chama o PrepareEnemies do Battle Start para criá-los e então os associa pontos específicos do mapa currentState = BattleStates.START; }
void OnGUI() { if (GUILayout.Button("NEXT STATE")) { if (currentState == BattleStates.START) { currentState = BattleStates.PLAYER; } else if (currentState == BattleStates.PLAYER) { currentState = BattleStates.PLAYERANIME; } else if (currentState == BattleStates.PLAYERANIME) { currentState = BattleStates.ENEMY; } else if (currentState == BattleStates.ENEMY) { currentState = BattleStates.ENEMYANIME; } else if (currentState == BattleStates.ENEMYANIME) { currentState = BattleStates.LOSE; } else if (currentState == BattleStates.LOSE) { currentState = BattleStates.WIN; } else if (currentState == BattleStates.WIN) { currentState = BattleStates.START; } } }
private void CheckForStatusEffect() { if (_hasHarass) { battleScreenManager._enemyHealth -= _damage; if (totalTurnCount == _endTurn) { _hasHarass = false; } } else if (_hasStun) { currentState = BattleStates.PLAYER_TURN; currentTurnOwner = BattleStates.PLAYER_TURN; playerCompletedTurn = false; if (totalTurnCount == _endTurn) { _hasStun = false; } } else if (_hasSleep) { currentState = BattleStates.PLAYER_TURN; currentTurnOwner = BattleStates.PLAYER_TURN; playerCompletedTurn = false; if (totalTurnCount == _endTurn) { _hasSleep = false; } } }
private void DecidirProximoAtor() { if (jogadorTerminouTurno && !inimigoTerminouTurno) //Se o jogador terminou turno, mas o inimigo não... { //..vez do inimigo currentState = BattleStates.ENEMYCHOICE; } if (!jogadorTerminouTurno && inimigoTerminouTurno) //Se o jogador não terminou o turno, mas o inimigo sim... { //...vez do jogador currentState = BattleStates.PLAYERCHOICE; } if (jogadorTerminouTurno && inimigoTerminouTurno) //Se tanto o jogador quanto o inimigo terminaram seus turnos { //terminar a rodada currentState = BattleStates.ENDROUND; foreach (Inimigo inim in inimigosList) //ao decidir que a rodada acabou cada inimigo pode agir de novo { inim.Agiu = false; } } if (!jogadorTerminouTurno && !inimigoTerminouTurno) { battleStartscript.EscolherOPrimeiro(); } }
protected void UpdateBattleState() { float healthPercent = m_playerHealth.GetCurrentHealthPercentage(); float bossHealthPercent = m_aiActor.healthHaver.GetCurrentHealthPercentage(); float absDiff = Mathf.Abs(healthPercent - bossHealthPercent); if (absDiff < 0.075f) { m_battleState = BattleStates.Balanced; this.ActivateBalancedState(); } else if (bossHealthPercent < healthPercent) { m_battleState = BattleStates.Losing; this.ActivateLosingState(); } else { // This is necessary as to not restart the sequence at every step if (m_battleState == BattleStates.Winning) { return; } m_battleState = BattleStates.Winning; m_sequenceIndex = 0; this.ActivateWinningState(); } }
// //this is just a button and has nothing to do with gameplay. // void OnGUI(){ // if(GUILayout.Button("NEXT STATE")){ // if (currentState == BattleStates.START) { // currentState = BattleStates.PLAYERCHOICE; // } else if (currentState == BattleStates.PLAYERCHOICE) { // currentState = BattleStates.ENEMYCHOICE; // } else if (currentState == BattleStates.ENEMYCHOICE) { // currentState = BattleStates.LOSE; // } else if (currentState == BattleStates.LOSE) { // currentState = BattleStates.WIN; // } else if (currentState == BattleStates.WIN) { // currentState = BattleStates.START; // // } // } // // } private void CheckWhoGoesNext() { //check to see if player won DidPlayerWinOrLose(); //check first to see if WIN/LOSS condition met before seeing who goes next if (currentState != BattleStates.WIN && currentState != BattleStates.LOSE) { if (playerDidCompleteTurn && !enemyDidCompleteTurn) { //enemy's turn currentState = BattleStates.ENEMYCHOICE; } if (!playerDidCompleteTurn && enemyDidCompleteTurn) { //player's turn currentState = BattleStates.PLAYERCHOICE; } if (playerDidCompleteTurn && enemyDidCompleteTurn) { //endturn state currentState = BattleStates.ENDTURN; } } }
public void OnGUI() { if (GUILayout.Button("NEXT STATE")) { if (currentState == BattleStates.START) { currentState = BattleStates.PLAYERCHOICE; }else if (currentState == BattleStates.PLAYERCHOICE) { currentState = BattleStates.PLAYERANIMATION; }else if (currentState == BattleStates.PLAYERANIMATION) { currentState = BattleStates.ENEMYCHOICE; }else if (currentState == BattleStates.ENEMYCHOICE) { currentState = BattleStates.ENEMYANIMATION; }else if (currentState == BattleStates.ENEMYANIMATION) { currentState = BattleStates.WIN; }else if (currentState == BattleStates.WIN) { currentState = BattleStates.LOSE; }else if (currentState == BattleStates.LOSE) { currentState = BattleStates.START; } } }
public void ShowTypeAbilities(int type) { abilityBranchSelected = type; switch (type) { case 1: bInput.ChangeButtonsText(3); bInput.ChangeState(BattleUI.JoystickInputStates.AIR); break; case 2: bInput.ChangeButtonsText(4); bInput.ChangeState(BattleUI.JoystickInputStates.FIRE); break; case 3: bInput.ChangeButtonsText(5); bInput.ChangeState(BattleUI.JoystickInputStates.WATER); break; case 4: bInput.ChangeButtonsText(6); bInput.ChangeState(BattleUI.JoystickInputStates.EARTH); break; } currentBattleState = BattleStates.SELECTABILITY; }
void RpcChangeToBoos() { enemyHealth = 400; enemyEnergy = 400; enemyHealth2 = 400; OnEnemyHealth2Changed(enemyHealth2); OnEnemyHealthChanged(enemyHealth); OnEnemyEnergyChanged(enemyEnergy); currentState = BattleStates.PLAYERCHOICE; turnChoosed = false; if (container != null) container.GetComponent<CanvasGroup>().alpha = 1; if (playerBox != null) { playerBox.SetActive(false); } if (normalRoom != null) { normalRoom.SetActive(false); } if (bossRoom != null) { bossRoom.SetActive(false); } }
void OnGUI() { if (GUILayout.Button("Next State")) { currentState = (BattleStates)(((int)currentState + 1) % 5); } }
void RpcChangeToMove() { if (container != null) container.GetComponent<CanvasGroup>().alpha = 0; if (playerBox != null) { playerBox.SetActive(true); } if (normalRoom != null) { normalRoom.SetActive(true); } else { playerBox = GameObject.Find("Player Box"); playerBox.SetActive(false); } if (bossRoom != null) { bossRoom.SetActive(true); } currentState = BattleStates.PLAYERCHOICE; }
void SelectTarget2() { battleObjects.SetActive(false); player.Attack(enemies[1]); if (enemies[1].health <= 0) { enemies[1].gameObject.SetActive(false); enemyButtons[1].interactable = false; } commandPanel.SetActive(false); Image image = atb.GetComponent <Image>(); image.color = filling; atb_transform.offsetMax = new Vector2(atb_transform.rect.xMin, atb_transform.rect.yMax); atbCur = 0; currentState = BattleStates.PLAYERANIMATE; bool alldead = true; for (int i = 0; i < enemyButtons.Length; ++i) { if (enemyButtons[i].interactable) { alldead = false; } } if (alldead) { currentState = BattleStates.WIN; } }
public void battleStart() { currentState = BattleStates.INTRO; limitBreakCollection = this.GetComponent <LimitBreakCollection>(); baseRunner = this.GetComponent <BaseRunner>(); dialogueManager = this.GetComponent <DialogueManager>(); }
// Start is called before the first frame update void Start() { _characterController1 = GetComponent <CharacterController1>(); states = BattleStates.Start; _startLevel2 = collisionZone2.GetComponent <StartLevel2>(); StartCoroutine(SetUpBattle()); }
public void TurnEnd() { if (IsBattleOver == true) { Debug.LogError("Trying to end a turn when the battle is over!"); return; } Debug.LogWarning($"Ended {CurrentEntityTurn.Name}'s Turn!"); //Update the next turn cycle TurnOrder.RemoveAt(0); //Start the cycle over if (TurnOrder.Count == 0) { for (int i = 0; i < Entities.Count; i++) { //Add only alive entities if (Entities[i].IsDead == false) { TurnOrder.Add(Entities[i]); } } } TurnOrder.Sort(SortBySpeed); BattleState = BattleStates.TurnDone; UpdateBattleState(); }
public void OnVictoryChoose(int i) { switch (i) { case 0: player.cambiaHp(200, 'c'); break; case 1: int num = UnityEngine.Random.Range(25, 35); MainMenu.almas += num; break; case 2: //buscar objeto break; default: Debug.LogError("This shouldn't be happening, but here we are..."); break; } // we should "respawn" enemies but we're "respawning" the scene but nobody knows heh heh heh. currentState = BattleStates.ENEMYC; Debug.Log(currentState); SceneManager.LoadScene("prueba"); }
void chooseAttack() { if (Input.GetKeyDown(KeyCode.LeftArrow)) { currentState = BattleStates.PLAYERCHOICE_ACT; source.PlayOneShot(menuCancel); } if (Input.GetKeyDown(KeyCode.RightArrow)) { currentState = BattleStates.PLAYERCHOICE_TARGET; source.PlayOneShot(menuSelect); } if (Input.GetKeyDown(KeyCode.DownArrow)) { attackIndex++; source.PlayOneShot(menuScroll); } if (Input.GetKeyDown(KeyCode.UpArrow)) { attackIndex += attacks.Count + 1; source.PlayOneShot(menuScroll); } attackReticle.transform.position = attacks[attackIndex % 2].transform.position + attackReticle.transform.TransformDirection(new Vector3(-2.25f, 1.25f, 0)); }
private void ManageDefend() { attackFinished = 1; GetCurrentCharacter().defendChar(); currentBattleState = BattleStates.WAITING; EndTurn(false, true); }
void OnGUI() { if (GUILayout.Button("NEXT STATE")) { if (currentState == BattleStates.START) { currentState = BattleStates.SPECIALANIMATE; } else if (currentState == BattleStates.SPECIALANIMATE) { currentState = BattleStates.PLAYERTURN; } else if (currentState == BattleStates.PLAYERTURN) { currentState = BattleStates.ENEMYTURN; } else if (currentState == BattleStates.ENEMYTURN) { currentState = BattleStates.LOSESTATE; } else if (currentState == BattleStates.LOSESTATE) { currentState = BattleStates.WINSTATE; } } }
void Start() { stateMachine = GetComponent <StateMachine>(); levelUp = GetComponent <LevelUp>(); currentState = BattleStates.START; hero = GetComponent <HeroCharacter>(); }
public void EndTurn() { if (currentState == BattleStates.START) { currentState = BattleStates.PLAYERCHOICE; } }
public IEnumerator LoadBuyMenu() { if (BattleManager.Instance.BattleState == BattleStates.GameOver) { yield break; } _lastState = BattleManager.Instance.BattleState; BattleManager.Instance.BattleState = BattleStates.BuyingCards; foreach (GameObject go in _soldOutMarkers) { Destroy(go); } _soldOutMarkers.Clear(); //Fade in _cg.blocksRaycasts = true; Tween fade = _cg.DOFade(1.0f, 1.0f); yield return(fade.WaitForCompletion()); _cg.interactable = true; //Deal Cards _activeCards.Clear(); _activeCardObjects.Clear(); for (int i = 0; i < DealAmt; i++) { StartCoroutine(DealNewCard()); } LeaveButton.onClick.AddListener(LeaveShop); }
//werkt void OnGUI() { if (GUILayout.Button("Next state")) { if (CurrentState == BattleStates.START) { CurrentState = BattleStates.PLAYERCHOICE; } else if (CurrentState == BattleStates.PLAYERCHOICE) { CurrentState = BattleStates.ENEMYCHOICE; } else if (CurrentState == BattleStates.ENEMYCHOICE) { CurrentState = BattleStates.LOSE; } else if (CurrentState == BattleStates.LOSE) { CurrentState = BattleStates.WIN; } else if (CurrentState == BattleStates.WIN) { CurrentState = BattleStates.START; } } }
public void loseActions() { moveNamesHolder.SetActive(false); gameLoop.isRunning = true; gameLoop.isBattle = false; gameLoop.cameraAnimator.SetBool("BattleState", false); gameLoop.cameraAnimator.SetBool("RunnerState", true); foreach (KeyValuePair <BaseCharacterClass, GameObject> character in participantDictionary) { if (character.Value.gameObject == playerPrefab) { continue; } else { Debug.Log("Destroying " + character.Value.name); Destroy(character.Value.gameObject); } } turnTracker = 0; beginningInitIsOver = false; camMovementScript.enabled = !camMovementScript.enabled; participantDictionary.Clear(); participantList.Clear(); heroList.Clear(); enemyList.Clear(); currentHero = 0; listCreationFinished = false; currentState = BattleStates.INTRO; gameLoop.gameManager.ReloadCheckpoint(); }
/* * void ataqueClick(){ * if(currentState==BattleStates.ENEMYC){ * foreach (npc h in all) { * if(h.clicked==true){ * h.cambiaHp(100,'f'); * player.restaCooldowns(); * foreach (npc h2 in all) { * h2.clicked=false; * } * StartCoroutine(waiter()); * } * } * } * } * * void habilidadClick(){ * if(currentState==BattleStates.ENEMYC){ * foreach (npc h in all) { * if(h.clicked==true){ * h.cambiaHp(120,'m'); * player.restaCooldowns(); * foreach (npc h2 in all) { * h2.clicked=false; * } * StartCoroutine(waiter()); * } * } * } * } */ IEnumerator waiter() { yield return(new WaitForSeconds(1)); if (currentState == BattleStates.ENEMYC) { currentState = BattleStates.PLAYER1C; } else if (currentState == BattleStates.PLAYER1C) { currentState = BattleStates.PLAYER2C; } else if (currentState == BattleStates.PLAYER2C) { currentState = BattleStates.PLAYER3C; } else if (currentState == BattleStates.PLAYER3C) { currentState = BattleStates.PLAYER4C; } else if (currentState == BattleStates.PLAYER4C) { currentState = BattleStates.PLAYER5C; } else if (currentState == BattleStates.PLAYER5C) { currentState = BattleStates.ENEMYC; } }
private void WhoChoosesNext() { if (playerCompletedTurn && enemyCompletedTurn) { //end turn currentState = BattleStates.ENDTURN; } if (playerCompletedTurn && !enemyCompletedTurn) { //enemy turn currentState = BattleStates.DELAY; } if (!playerCompletedTurn && enemyCompletedTurn) { //player turn currentState = BattleStates.DELAY; } if (GameInformation.currentHealth <= 0) { currentState = BattleStates.LOSE; } if (GameInformation.currentEnemyHealth <= 0) { currentState = BattleStates.WIN; } }
public static void TestTurns() { if(GUI.Button(new Rect(100,100,100,30), "Player Turn")){ if(TurnBasedCombatStateMachine.currentState != TurnBasedCombatStateMachine.BattleStates.PLAYERCHOICE){ TurnBasedCombatStateMachine.currentState = TurnBasedCombatStateMachine.BattleStates.PLAYERCHOICE; } } if(GUI.Button(new Rect(150,150,100,30), "Win Battle")){ if(TurnBasedCombatStateMachine.currentState != TurnBasedCombatStateMachine.BattleStates.WIN){ TurnBasedCombatStateMachine.currentState = TurnBasedCombatStateMachine.BattleStates.WIN; } } if(GUI.Button(new Rect(200,200,100,30), "Next Turn")){ switch(currentState){ case(BattleStates.ENEMYCHOICE): currentState = BattleStates.PLAYERCHOICE; break; case(BattleStates.CALCDAMAGE): currentState = BattleStates.STATUSEFFECTS; break; case(BattleStates.STATUSEFFECTS): currentState = BattleStates.ENEMYCHOICE; break; } } }
void Start() { currentState = BattleStates.Start; Enemie_Display a = Enemy1.GetComponent <Enemie_Display>(); Enemie_Display b = Enemy2.GetComponent <Enemie_Display>(); Enemie_Display c = Enemy3.GetComponent <Enemie_Display>(); if (Game_manager.WhatEnemyAreYouFacing == "Sinister Crow") { Enemy2.SetActive(true); Enemy3.SetActive(true); } else { Enemy2.SetActive(false); Enemy3.SetActive(false); } foreach (Enemie e in Enemiecards) { if (e.name == Game_manager.WhatEnemyAreYouFacing) { a.enemie = e; b.enemie = e; c.enemie = e; } } }
protected override void OnEnterState(int oldMask, BattleStates state) { if (state == BattleStates.Ended) { PlayerPrefs.SetInt("FinishTrain", 1); m_loadTime = Time.realtimeSinceStartup - m_loadTime; DispatchEvent(Events.LAUNCH_PROCESS, Event_.Pop(LaunchProcess.ShowLevelEnd, 1)); DispatchEvent(Events.LAUNCH_PROCESS, Event_.Pop(LaunchProcess.ShowLevelTime, m_loadTime)); moduleStory.workOffline = false; DelayEvents.Add(() => { moduleGlobal.FadeIn(1.0f, 1, false, () => { Root.instance.StartCoroutine(WaitLoginLoaded()); }); }, 1.5f); return; } base.OnEnterState(oldMask, state); }
// Update is called once per frame void Update() { Debug.Log(currentState); switch (currentState) { case (BattleStates.START): // SETUP BATTLE FUNCTION // battle begins // create enemy battleStateStartScript.PrepareBattle(); break; case (BattleStates.PLAYERCHOICE): break; case (BattleStates.ENEMYCHOICE): //coded ai goes here break; case (BattleStates.CALCDAMAGE): damage = battleCalcScript.CalculateUsedPlayerAbilityDamage(playerAbility); Debug.Log("CALCULATING DAMAGE"); Debug.Log(damage); damage_caused = battleStateStartScript.EnemyDamage(damage); //damage_text = damage.ToString(); //GUI.Label(damage_text); //GUILayout.Label (damage_text); //GUILayout.Text(battleStateStartScript.EnemyDamage(damage)); //GUILayout.Label (damage); //GUILayout.Label (battleStateStartScript.EnemyDamage(damage).ToString); // TRYING TO PRINT OUT RESULTS OF DAMAGE //GUI.Label(new Rect(Screen.width - 250,Screen.height - 50,100,30), damage.ToString); currentState = BattleStates.ENEMYCHOICE; //coded ai goes here break; case (BattleStates.CALCENEMYDAMAGE): currentState = BattleStates.PLAYERCHOICE; break; case (BattleStates.LOSE): //Application.Quit(); break; case (BattleStates.WIN): //Application.Quit(); break; } }
void OnGUI() { if (GUILayout.Button("NEXT STATE")) { switch (currentState) { case BattleStates.START: currentState = BattleStates.PLAYERCHOICE; break; case BattleStates.PLAYERCHOICE: currentState = BattleStates.ENEMYCHOICE; break; case BattleStates.ENEMYCHOICE: currentState = BattleStates.LOSE; break; case BattleStates.LOSE: currentState = BattleStates.WIN; break; case BattleStates.WIN: currentState = BattleStates.START; break; } } }
void Start () { currentState = BattleStates.START; //Initial BattleState monsterNum=Random.Range(1, 4); //Define number of Monsters and initialize iterator i=0; }
void Start() { currentState = BattleStates.INIT; Debug.Log(currentState); enemies.Add(new Slime()); enemies.Add(new Slime()); enemies.Add(new Slime()); currentState = BattleStates.PLAYERCHOICE; Debug.Log(currentState); }
void OnGUI() { if (GUILayout.Button("NEXT STATE")) { if (currentState == BattleStates.START) { currentState = BattleStates.SPECIALANIMATE; } else if (currentState == BattleStates.SPECIALANIMATE) { currentState = BattleStates.PLAYERTURN; } else if (currentState == BattleStates.PLAYERTURN) { currentState = BattleStates.ENEMYTURN; } else if (currentState == BattleStates.ENEMYTURN) { currentState = BattleStates.LOSESTATE; } else if (currentState == BattleStates.LOSESTATE) { currentState = BattleStates.WINSTATE; } } }
void OnGUI() { if(GUILayout.Button("NEXT STATE")) { if(currentState == BattleStates.START) { currentState = BattleStates.PLAYERCHOICE; } else if (currentState == BattleStates.PLAYERCHOICE) { currentState = BattleStates.ENEMYCHOICE; } else if (currentState == BattleStates.START) { currentState = BattleStates.PLAYERCHOICE; } else if (currentState == BattleStates.START) { currentState = BattleStates.PLAYERCHOICE; } else if (currentState == BattleStates.START) { currentState = BattleStates.PLAYERCHOICE; } } }
private void Update() { switch (this.currnetState) { case BattleStates.Start: this.currnetState = BattleStates.Player; break; case BattleStates.Player: this.currnetState = BattleStates.Enemy; break; case BattleStates.Enemy: break; case BattleStates.Lose: break; case BattleStates.Win: break; default: break; } }
public void setCurrentState(string stateName) { switch(stateName) { case "LISTEN": { currentState = BattleStates.LISTEN; break; } case "CHOOSEATTACK": { currentState = BattleStates.CHOOSEATTACK; break; } case "SELECTTARGET": { currentState = BattleStates.SELECTTARGET; break; } case "ATTACKING": { currentState = BattleStates.ATTACKING; break; } case "ENEMYATTACK": { currentState = BattleStates.ENEMYATTACK; break; } case "LOSE": { currentState = BattleStates.LOSE; break; } case "WIN": { currentState = BattleStates.WIN; break; } } }
void OnGUI() { if (GUILayout.Button ("NEXT STATE")) { switch (currentState) { case BattleStates.START: currentState = BattleStates.PLAYERCHOICE; break; case BattleStates.PLAYERCHOICE: currentState = BattleStates.ENEMYCHOICE; break; case BattleStates.ENEMYCHOICE: currentState = BattleStates.LOSE; break; case BattleStates.LOSE: currentState = BattleStates.WIN; break; case BattleStates.WIN: currentState = BattleStates.START; break; default: break; } } }
// Update is called once per frame void Update() { switch (current_state) { case BattleStates.START: if (!start_phase) { start_phase = true; // Opening animation // Player draws opening hand player.Player_Spell_Book.Draw_Hand(); enemy.Player_Spell_Book.Draw_Hand(); // Display information to player Display_Spells(); current_state = BattleStates.BEGIN; } break; case BattleStates.BEGIN: if (!begin_phase) { begin_phase = true; //player.Players_Summon.Poison = 10; //player.Players_Summon.Burn = 10; player_choice = null; enemy_choice = null; player_made_choice = false; remove_indexs = new List<int>(); string ppd = (-Poisoned(player)).ToString(); string epd = (-Poisoned(enemy)).ToString(); string pbd = (-Burned(player)).ToString(); string ebd = (-Burned(enemy)).ToString(); poison_dmg.GetComponentInChildren<Text>().text = "Poison: " + ppd; burn_dmg.GetComponentInChildren<Text>().text = "Burn: " + pbd; Setup_Burn_Text(pbd, ebd); Start_Burn_Text(); Setup_Poison_Text(ppd, epd); Start_Poison_Text(); Display_Results(); if(Game_Over()) { break; } Reset_Spell_Buttons(); current_state = BattleStates.PLAYERCHOICE; } break; case BattleStates.PLAYERCHOICE: if (!player_phase) { player_phase = true; Enable_Spells(); Disable_Finishers(); if (Paralyzed(player)) { if (UnityEngine.Random.Range(0, 101) < 50) { //Player is paralyzed message Debug.Log("Player is paralyzed and can't move"); paralyze_dmg.GetComponentInChildren<Text>().text = "Paralyze: true"; current_state = BattleStates.ENEMYCHOICE; break; } } paralyze_dmg.GetComponentInChildren<Text>().text = "Paralyze: false"; // Draw for turn left_log.GetComponentsInChildren<Text>()[0].text = "Select a spell to cast"; Draw(); Display_Spells(); } break; case BattleStates.ENEMYCHOICE: if (!enemy_phase) { enemy_phase = true; if (Paralyzed(enemy)) { if (UnityEngine.Random.Range(0, 101) < 50) { current_state = BattleStates.RESULTS; break; } } enemy_cast(); current_state = BattleStates.RESULTS; } break; case BattleStates.RESULTS: if (!results_phase) { results_phase = true; Thread.Sleep(500); Calculate_Results(); Display_Results(); if(Game_Over()) { break; } //current_state = BattleStates.RESET; } break; case BattleStates.RESET: begin_phase = false; player_phase = false; enemy_phase = false; results_phase = false; current_state = BattleStates.BEGIN; break; case BattleStates.LOSE: if (!lose_phase) { lose_phase = true; if(GameManager.instance.tournament_mode) { Tournament.instance.Player_Lost(); finish_window.GetComponentsInChildren<Button>()[0].onClick.RemoveAllListeners(); finish_window.GetComponentsInChildren<Button>()[0].onClick.AddListener(() => { Return_To_Tournament(); }); } player_summon_sprite.layer = 9; enemy_summon_sprite.layer = 9; Lose_Popup(); } break; case BattleStates.WIN: if (!win_phase) { win_phase = true; if (GameManager.instance.tournament_mode) { Tournament.instance.Player_Won(); finish_window.GetComponentsInChildren<Button>()[0].onClick.RemoveAllListeners(); finish_window.GetComponentsInChildren<Button>()[0].onClick.AddListener(() => { Return_To_Tournament(); }); } player_summon_sprite.layer = 9; enemy_summon_sprite.layer = 9; Win_Popup(); } break; case BattleStates.TIE: if (!tie_phase) { tie_phase = true; if (GameManager.instance.tournament_mode) { Tournament.instance.Player_Lost(); finish_window.GetComponentsInChildren<Button>()[0].onClick.RemoveAllListeners(); finish_window.GetComponentsInChildren<Button>()[0].onClick.AddListener(() => { Return_To_Tournament(); }); } player_summon_sprite.layer = 9; enemy_summon_sprite.layer = 9; Tie_Popup(); } break; } }
public override void BeforeActStart(BattleStates.ThinkAction thinkAction) { base.BeforeActStart(thinkAction); if (thinkAction.Target == Inflictor) { thinkAction.Active = false; beforeActFinished = false; shudderManager.Reset(thinkAction.Actor); particleManager.Reset(); } else beforeActFinished = true; }
private void movePartyMemberWithinList(PartyMember partyMember, bool edgeIndexIsZero, int nextRelativeIndex, BattleStates.Think thinkState) { if (!party.Contains(partyMember)) return; List<PartyMember> list = GetListWithPartyMember(partyMember); int partyMemberIndex = list.IndexOf(partyMember); if (partyMemberIndex != (edgeIndexIsZero ? 0 : list.Count - 1)) // if not at the end already { list.RemoveAt(partyMemberIndex); int index = partyMemberIndex + nextRelativeIndex; if (index == 0 && list.Count > 0 && thinkState.PartyMemberHasCompletedThinkAction(list[index])) { Weapon frontPartyMemberWeapon = list[index].EquippedWeapon; if (frontPartyMemberWeapon != null && frontPartyMemberWeapon.Data.WeaponType == WeaponType.Melee) ++index; } list.Insert(index, partyMember); } }
public void MovePartyMemberUp(PartyMember partyMember, BattleStates.Think thinkState) { if (!partyMember.HasStatusEffectOfType(StatusEffectType.Paralysis)) movePartyMemberAcrossLists(partyMember, true, -1, thinkState); }
// last item/back is towards edge of screen public void MovePartyMemberBack(PartyMember partyMember, BattleStates.Think thinkState) { if (!partyMember.HasStatusEffectOfType(StatusEffectType.Paralysis)) movePartyMemberWithinList(partyMember, false, 1, thinkState); }
void Update () { //Main Battle Actions (non-GUI) switch (currentState){ case (BattleStates.START): //Create Monsters depending on how many we found while(i<=monsterNum){ switch(i){ case 1: monster1 = new CreateNewMonster().createMonster(); break; case 2: monster2 = new CreateNewMonster().createMonster(); break; case 3: monster3 = new CreateNewMonster().createMonster(); break; } i++; } /*beginning=true; showPlayerText1=false; if (beginning) { if (!showPlayerText1) { if (i>=1){ GUI.Label(new Rect(20, 375, 100, 20), monster1.MonsterName+" appeared!"); }else if (i>=2){ GUI.Label(new Rect(20, 395, 100, 20), monster2.MonsterName+" appeared!"); }else if (i==3){ GUI.Label(new Rect(20, 415, 100, 20), monster3.MonsterName+" appeared!"); } if(!isRunning) StartCoroutine(slowText()); } }*/ //after creating go to playerchoice state currentState=BattleStates.PLAYERCHOICE; break; case (BattleStates.PLAYERCHOICE): //DONE IN ONGUI() break; case (BattleStates.ENEMYCHOICE): //DONE IN ONGUI() break; case (BattleStates.LOSE): //DONE IN ONGUI() break; case (BattleStates.WIN): break; case (BattleStates.CAPTURE): //Capture Logic //Add monster to LIST if (Team.team.Count > 2) { MonsterList.monstersList.Add(monster1); added = false; } else { Team.team.Add(monster1); added = true; } //finish battle currentState = BattleStates.END; break; case (BattleStates.END): //finish battle //recover position //load Scene PlayerPrefs.SetInt("returning", 1); Application.LoadLevel("Main"); break; } }
// Use this for initialization void Start() { player = GameManager.instance.player; enemy = GameManager.instance.enemy; player_summon_image.GetComponentsInChildren<Image>()[0].sprite = Load_Summon_Image(player); enemy_summon_image.GetComponentsInChildren<Image>()[0].sprite = Load_Summon_Image(enemy); player_summon_image.SetActive(false); enemy_summon_image.SetActive(false); player_summon_sprite = Load_Summon_Sprite(player); enemy_summon_sprite = Load_Summon_Sprite(enemy); player_summon_sprite = (GameObject)Instantiate(player_summon_sprite, new Vector3(-3.5f, 1.5f, -1), Quaternion.identity); player_summon_sprite.GetComponent<Transform>().localScale = new Vector3(3, 3, 1); enemy_summon_sprite = (GameObject)Instantiate(enemy_summon_sprite, new Vector3(3.5f, 1.5f, -1), Quaternion.identity); enemy_summon_sprite.GetComponent<Transform>().localScale = new Vector3(-3, 3, 1); player_made_choice = false; start_phase = false; begin_phase = false; player_phase = false; lose_phase = false; win_phase = false; tie_phase = false; position_1 = spell_1.transform.localPosition; position_2 = spell_2.transform.localPosition; position_3 = spell_3.transform.localPosition; position_4 = spell_4.transform.localPosition; finish_window_position = finish_window.transform.localPosition; off_screen = new Vector2(1000, 1000); Setup_Finishers(); Setup_Spell_Font(); green = new UnityEngine.Color(0, 214, 0); red = new UnityEngine.Color(255, 0, 0); start_height = player_hp_bar.GetComponent<Image>().rectTransform.rect.height; player_hp_text.GetComponent<Text>().fontSize = (int)(Screen.width * 0.018f); enemy_hp_text.GetComponent<Text>().fontSize = (int)(Screen.width * 0.018f); left_log.GetComponent<Text>().fontSize = (int)(Screen.width * 0.014f); poison_dmg.GetComponent<Text>().fontSize = (int)(Screen.width * 0.014f); burn_dmg.GetComponent<Text>().fontSize = (int)(Screen.width * 0.014f); paralyze_dmg.GetComponent<Text>().fontSize = (int)(Screen.width * 0.014f); finish_window.GetComponentsInChildren<Text>()[0].fontSize = (int)(Screen.width * 0.03f); finish_window.GetComponentsInChildren<Text>()[1].fontSize = (int)(Screen.width * 0.02f); finish_window.GetComponentsInChildren<Text>()[2].fontSize = (int)(Screen.width * 0.02f); finish_window.GetComponentsInChildren<Text>()[3].fontSize = (int)(Screen.width * 0.02f); finish_window.GetComponentsInChildren<Text>()[4].fontSize = (int)(Screen.width * 0.02f); finish_window.GetComponentsInChildren<Text>()[5].fontSize = (int)(Screen.width * 0.02f); player_names.GetComponentsInChildren<Text>()[0].fontSize = (int)(Screen.width * 0.02f); string pvp = player.Player_Name + " VS. " + enemy.Player_Name; player_names.GetComponentsInChildren<Text>()[0].text = pvp; toggle_page.GetComponentsInChildren<Text>()[0].fontSize = (int)(Screen.width * 0.016f); finish_window.transform.localPosition = off_screen; Disable_Finishers(); combo_finisher_spell = new FinalStrike(); reflect_finisher_spell = new DamageReflection(); affliction_finisher_spell = new GreatAffliction(); player_damage_text_start = player_damage_text.transform.position; enemy_damage_text_start = enemy_damage_text.transform.position; current_state = BattleStates.START; }
void OnGUI() { Debug.Log (currentState); //Define nextPage arrow Texture2D arrow = Resources.Load("arrow", typeof(Texture2D)) as Texture2D; //Define Skin for GUI GUI.skin = skin; //Define size for LABELS AND BUTTONS GUIStyle customButton = new GUIStyle("button"); GUIStyle customName = new GUIStyle("label"); customButton.fontSize = 25; customName.fontSize = 27; //TEAM MONSTER 1 //MONSTER1 NAME, HP AND MP GUI.Label(new Rect(40, 20, 100, 20), Team.team[0].MonsterName, customName); GUI.Label(new Rect(60, 54, 100, 20), "HP: " + Team.team[0].HP.ToString(), customName); GUI.Label(new Rect(60, 84, 100, 20), "MP: " + Team.team[0].MP.ToString(), customName); //TEAM MONSTER 2 //MONSTER 2 NAME, HP AND MP if (Team.team.Count >1 ) { GUI.Label(new Rect(245, 16, 100, 20), Team.team[1].MonsterName, customName); GUI.Label(new Rect(260, 54, 100, 20), "HP: " + Team.team[1].HP.ToString(), customName); GUI.Label(new Rect(260, 84, 100, 20), "MP: " + Team.team[1].MP.ToString(), customName); } //TEAM MONSTER 3 //MONSTER 3 NAME, HP AND MP if (Team.team.Count >2) { GUI.Label(new Rect(440, 20, 100, 20), Team.team[2].MonsterName, customName); GUI.Label(new Rect(460, 54, 100, 20), "HP: " + Team.team[2].HP.ToString(), customName); GUI.Label(new Rect(460, 84, 100, 20), "MP: " + Team.team[2].MP.ToString(), customName); } //ENEMY MONSTER 1 //MONSTER1 TEXTURE (ONLY WHEN ALIVE!!) if (!monster1Dead) { string resource1 = monster1.ML + "/" + monster1.MonsterType + monster1.Sprite; Texture2D textMonster1 = Resources.Load(resource1, typeof(Texture2D)) as Texture2D; GUI.DrawTexture(new Rect(240, 160, 120, 120), textMonster1); } //ENEMY MONSTER 2 //MONSTER 2 NAME, HP AND MP if (monster2 != null) { if (!monster2Dead) { //MONSTER2 TEXTURE (ONLY WHEN ALIVE!!) string resource2 = monster2.ML + "/" + monster2.MonsterType + monster2.Sprite; Texture2D textMonster2 = Resources.Load(resource2, typeof(Texture2D)) as Texture2D; GUI.DrawTexture(new Rect(30, 160, 120, 120), textMonster2); } } //ENEMY MONSTER 3 //MONSTER 3 NAME, HP AND MP if (monster3 != null) { if (!monster3Dead) { //MONSTER3 TEXTURE (ONLY WHEN ALIVE!!) string resource3 = monster3.ML + "/" + monster3.MonsterType + monster3.Sprite; Texture2D textMonster3 = Resources.Load(resource3, typeof(Texture2D)) as Texture2D; GUI.DrawTexture(new Rect(460, 160, 120, 120), textMonster3); } } //BOTTOM BUTTONS if (!fightPressed && !scoutPressed && !skillPressed && !runPressed) { //check for any button press if (GUI.Button (new Rect (20, 370, 300, 45), "FIGHT", customButton)) { messageNum=0; foreach (BaseStatMonster m in Team.team) { messageNum++; if(Random.Range(1,65)==2){ message[messageNum]=m.MonsterName+" Missed his target!!"; }else{ if (monsterNum>1){ if(monsterNum>2){ if (monster3.HP<monster2.HP){ if(monster1.HP<monster3.HP){monsterHit=1;}else{monsterHit=3;} }else{ if(monster1.HP<monster2.HP){monsterHit=1;}else{monsterHit=2;} } }else{ if (monster1.HP <= 0){ if(monster3==null)monsterHit=2; else if(monster2==null)monsterHit=3; if(monster2.HP<monster3.HP){ monsterHit=2; }else{ monsterHit=3; } } else if (monster2.HP <= 0){ if(monster3==null)monsterHit=1; else if(monster1.HP<monster3.HP){ monsterHit=1; }else{ monsterHit=3; } } else if (monster3==null|| monster3.HP <= 0){if(monster1.HP<monster2.HP){monsterHit=1;}else{monsterHit=2;}} } }else{ if ((monster1.HP <= 0)&&(monster2 == null || monster2.HP<=0)){ if(monster3==null){if (!isRunning)StartCoroutine (slowText ()); currentState = BattleStates.ENEMYCHOICE;} else if (monster3.HP>0){ monsterHit=3; }else {if (!isRunning)StartCoroutine (slowText ()); currentState = BattleStates.ENEMYCHOICE;} } else if ((monster1.HP <= 0)&&(monster3==null|| monster3.HP <= 0)){ if(monster2==null){if (!isRunning)StartCoroutine (slowText ()); currentState = BattleStates.ENEMYCHOICE;} if (monster2.HP>0){ monsterHit=2; }else {if (!isRunning)StartCoroutine (slowText ()); currentState = BattleStates.ENEMYCHOICE;} } else if ((monster2==null|| monster2.HP <= 0)&&(monster3==null|| monster3.HP <= 0)){ if(monster1==null){if (!isRunning)StartCoroutine (slowText ()); currentState = BattleStates.ENEMYCHOICE;} if (monster1.HP>0){ monsterHit=1; }else {if (!isRunning)StartCoroutine (slowText ()); currentState = BattleStates.ENEMYCHOICE;} } } switch(monsterHit){ case 1: if (monster1.HP>0){ if(Random.Range((1+m.Level/200),59)==58){ damage=(int)Mathf.Ceil((m.Stren)*Random.Range(0.8f,1f)); }else{ damage=(int)Mathf.Ceil((m.Stren-(monster1.Defen)/2)*Random.Range (0.4f,0.6f)); } if (damage<1)damage=1; monster1.HP -= damage; message[messageNum]=m.MonsterName+" attacks "+monster1.MonsterName+" for "+damage.ToString()+" damage"; } else { message[messageNum]=m.MonsterName+" attack fails!"; } break; case 2: if (monster2.HP > 0) { if(Random.Range((1+m.Level/200),59)==58){ damage=(int)Mathf.Ceil((m.Stren)*Random.Range(0.8f,1f)); }else{ damage=(int)Mathf.Ceil((m.Stren-(monster2.Defen)/2)*Random.Range (0.4f,0.6f)); } if (damage<1)damage=1; monster2.HP -=damage; message[messageNum]=m.MonsterName+" attacks "+monster2.MonsterName+" for "+damage.ToString()+" damage"; }else{ message[messageNum]=m.MonsterName+" attack fails!"; } break; case 3: if (monster3.HP > 0) { if(Random.Range((1+m.Level/200),59)==58){ damage=(int)Mathf.Ceil((m.Stren)*Random.Range(0.8f,1f)); }else{ damage=(int)Mathf.Ceil((m.Stren-(monster3.Defen))/2*Random.Range (0.4f,0.6f)); } if (damage<1)damage=1; monster3.HP -= damage; message[messageNum]=m.MonsterName+" attacks "+monster3.MonsterName+" for "+damage.ToString()+" damage"; }else{ message[messageNum]=m.MonsterName+" attack fails!"; } break; } } Debug.Log("HP: "+monster1.HP); Debug.Log ("MNUM: "+monsterNum); } fightPressed = true; showPlayerText1 = false; } } if (fightPressed) { if (!showPlayerText1) { //SLOW DESCRIPTION if (messageNum >= 1){ GUI.Label (new Rect (20, 375, 100, 20), message[1], customName); if (messageNum >= 2){ GUI.Label (new Rect (20, 405, 100, 20), message[2], customName); if (messageNum == 3) GUI.Label (new Rect (20, 435, 100, 20), message[3], customName); } } GUI.DrawTexture(new Rect(600, 445, 18, 18), arrow); if (!isRunning)StartCoroutine (slowText ()); currentState = BattleStates.ENEMYCHOICE; } } if (!fightPressed && !scoutPressed && !skillPressed && !runPressed) { if (GUI.Button(new Rect(20, 420, 300, 45), "SKILL", customButton)) { skillPressed = true; showPlayerText1 = false; } } if (skillPressed) { if (!showPlayerText1) { GUI.Label(new Rect(20, 375, 100, 20), "No Skills learned yet!", customName); GUI.DrawTexture(new Rect(600, 445, 18, 18), arrow); if (!isRunning) StartCoroutine(slowText()); } } if (!fightPressed && !scoutPressed && !skillPressed && !runPressed) { if (GUI.Button(new Rect(320, 370, 300, 45), "SCOUT", customButton)) { scoutPressed = true; showPlayerText1 = false; } } if (scoutPressed) { if (!showPlayerText1) { GUI.Label(new Rect(20, 375, 100, 20), monster1.MonsterName+" successfully captured!", customName); GUI.DrawTexture(new Rect(600, 445, 18, 18), arrow); if (Input.GetKeyDown("space")|| Input.GetKeyDown("e")) { currentState = BattleStates.CAPTURE; } } } if (!fightPressed && !scoutPressed && !skillPressed && !runPressed) { if (GUI.Button(new Rect(320, 420, 300, 45), "RUN", customButton)) { runPressed = true; showPlayerText1 = false; } } if (runPressed) { if (!showPlayerText1) { GUI.Label(new Rect(20, 375, 100, 20), "Sucessfully Escaped!", customName); GUI.DrawTexture(new Rect(600, 445, 18, 18), arrow); if (Input.GetKeyDown("space") || Input.GetKeyDown("e")) { currentState = BattleStates.END; } } } //ENEMYCHOICE //CHECK IF DEATH AND IF END if (currentState == BattleStates.ENEMYCHOICE) { //DIVIDE BETWEEN 1 OR 2/3 if (monster2 != null) { //DIVIDE BETWEEN 2 AND 3 if (monster3 != null) { //1-2-3 if (monster1.HP <= 0) { monster1Dead = true; monsterNum=2; if (monster2.HP <= 0) { monster2Dead = true; monsterNum=1; if (monster3.HP <= 0) { monster3Dead = true; monsterNum=0; currentState = BattleStates.WIN; } else { //ADD ENEMY ATTACK!! currentState = BattleStates.PLAYERCHOICE; } }//1-3-2 else if (monster3.HP <= 0) { monster3Dead = true; monsterNum=1; if (monster2.HP <= 0) { monster2Dead = true; monsterNum=0; currentState = BattleStates.WIN; } else { //ADD ENEMY ATTACK!! currentState = BattleStates.PLAYERCHOICE; } } else { //ADD ENEMY ATTACK!! currentState = BattleStates.PLAYERCHOICE; } }//2-1-3 else if (monster2.HP <= 0) { monster2Dead = true; monsterNum=2; if (monster1.HP <= 0) { monster1Dead = true; monsterNum=1; if (monster3.HP <= 0) { monster3Dead = true; monsterNum=0; currentState = BattleStates.WIN; } else { //ADD ENEMY ATTACK!! currentState = BattleStates.PLAYERCHOICE; } }//2-3-1 else if (monster3.HP <= 0) { monster3Dead = true; monsterNum=1; if (monster1.HP <= 0) { monster1Dead = true; monsterNum=0; currentState = BattleStates.WIN; } else { //ADD ENEMY ATTACK!! currentState = BattleStates.PLAYERCHOICE; } } else { //ADD ENEMY ATTACK!! currentState = BattleStates.PLAYERCHOICE; } }//3-1-2 else if (monster3.HP <= 0) { monster3Dead = true; monsterNum=2; if (monster1.HP <= 0) { monster1Dead = true; monsterNum=1; if (monster2.HP <= 0) { monster2Dead = true; monsterNum=0; currentState = BattleStates.WIN; } else { //ADD ENEMY ATTACK!! currentState = BattleStates.PLAYERCHOICE; } }//3-2-1 else if (monster2.HP <= 0) { monster2Dead = true; monsterNum=1; if (monster1.HP <= 0) { monster1Dead = true; monsterNum=0; currentState = BattleStates.WIN; } else { //ADD ENEMY ATTACK!! currentState = BattleStates.PLAYERCHOICE; } } else { //ADD ENEMY ATTACK!! currentState = BattleStates.PLAYERCHOICE; } } else { //ADD ENEMY ATTACK!! currentState = BattleStates.PLAYERCHOICE; } }//1-2 else { if (monster1.HP <= 0) { monster1Dead = true; monsterNum=1; if (monster2.HP <= 0) { monster2Dead = true; monsterNum=0; currentState = BattleStates.WIN; } else { //ADD ENEMY ATTACK!! currentState = BattleStates.PLAYERCHOICE; } }//2-1 else if (monster2.HP <= 0) { monster2Dead = true; monsterNum=1; if (monster1.HP <= 0) { monster1Dead = true; monsterNum=0; currentState = BattleStates.WIN; } else { //ADD ENEMY ATTACK!! currentState = BattleStates.PLAYERCHOICE; } } else { //ADD ENEMY ATTACK!! currentState = BattleStates.PLAYERCHOICE; } } }//1 else { if (monster1.HP <= 0) { monsterNum=0; monster1Dead = true; currentState = BattleStates.WIN; } else { //ADD ENEMY ATTACK!! currentState = BattleStates.PLAYERCHOICE; } } } if (currentState == BattleStates.WIN) { showPlayerText1=true; fightPressed = true; GUI.Label (new Rect (20, 375, 100, 20), "Monsters defeated!",customName); GUI.DrawTexture(new Rect(600, 445, 18, 18), arrow); if (Input.GetKeyDown ("space") || Input.GetKeyDown ("e")) { currentState = BattleStates.END; } } }
// Use this for initialization void Start () { hasAddedXP = false; currentState = BattleStates.START; }
IEnumerator Move_Text() { float timer = 0; int count = 0; while (timer < 1.5f) { Vector2 position1 = new Vector2(); position1.x = -(int)(Screen.width * 0.2f); position1.y = (int)(Screen.height * 0.15f * player.Players_Summon.Stage) + (count/2); player_damage_text.transform.localScale = new Vector3(1, 1, 1); player_damage_text.transform.localPosition = position1; Vector2 position2 = new Vector2(); position2.x = (int)(Screen.width * 0.18f); position2.y = (int)(Screen.height * 0.15f * enemy.Players_Summon.Stage) + (count/2); enemy_damage_text.transform.localScale = new Vector3(1, 1, 1); enemy_damage_text.transform.localPosition = position2; count++; timer += Time.deltaTime; yield return null; } Destroy(player_damage_text); Destroy(enemy_damage_text); current_state = BattleStates.RESET; }
/*******************************Update*************************************** * In: * Out: * Purpose: Maintains the combat states for turn based combat * **************************************************************************/ void Update () { Debug.Log(currentState); switch (currentState) { case (BattleStates.START): battleStateStart.PrepareBattle(); totalTurnCount = 0; break; case (BattleStates.PLAYER_CHOICE): currentTurn = BattleStates.PLAYER_CHOICE; break; case (BattleStates.ENEMY_CHOICE): currentTurn = BattleStates.ENEMY_CHOICE; currentState = BattleStates.CALCULATE_DAMAGE; //enemyChoiceScript.EnemyCompleteTurn(); break; case (BattleStates.CALCULATE_DAMAGE): if (currentTurn == BattleStates.PLAYER_CHOICE) battleCalcScript.CalculatePlayerAbilityDamage(playerUsedAbility); if (currentTurn == BattleStates.ENEMY_CHOICE) battleCalcScript.CalculateEnemyAbilityDamage(enemyUsedAbility); break; case (BattleStates.ADD_STATUS_EFFECT): //if status effect exists add it here break; case (BattleStates.END_TURN): //playerDidCompleteTurn = false; //enemyDidCompleteTurn = false; ++totalTurnCount; Debug.Log(totalTurnCount); Debug.Break(); if(CheckWinCondition()) { currentState = BattleStates.WIN; } else if (CheckLoseCondition()) { currentState = BattleStates.LOSE; } else { if (currentTurn == BattleStates.PLAYER_CHOICE) { currentState = BattleStates.ENEMY_CHOICE; } else { currentState = BattleStates.PLAYER_CHOICE; } } break; case (BattleStates.WIN): if (!hasAddedXP) { //AwardExperience.AddExperience(); //go back to exploration scene } Application.LoadLevel("Wasteland"); break; case (BattleStates.LOSE): //not sure what happens here yet //game over for now. player goes back //to start screen Application.LoadLevel("IntroScreen"); break; case (BattleStates.RAN_AWAY): Application.LoadLevel("Wasteland"); break; } }
private bool Game_Over() { if (enemy.Players_Summon.Health <= 0 && player.Players_Summon.Health <= 0) { Disable_Spells(); Disable_Finishers(); current_state = BattleStates.TIE; return true; } else if (enemy.Players_Summon.Health <= 0) { Disable_Spells(); Disable_Finishers(); current_state = BattleStates.WIN; return true; } else if (player.Players_Summon.Health <= 0) { Disable_Spells(); Disable_Finishers(); current_state = BattleStates.LOSE; return true; } return false; }
// first item/forward is towards middle of screen public void MovePartyMemberForward(PartyMember partyMember, BattleStates.Think thinkState) { if (!partyMember.HasStatusEffectOfType(StatusEffectType.Paralysis)) movePartyMemberWithinList(partyMember, true, -1, thinkState); }
public void Select_Spell(string spell) { switch(spell) { case "Spell_1": if(player_made_choice) { spell_1.GetComponentsInChildren<Image>()[0].color = red; spell_1.GetComponentsInChildren<Button>()[0].interactable = false; remove_indexs.Add(0); break; } spell_1.GetComponentsInChildren<Image>()[0].color = green; spell_1.GetComponentsInChildren<Button>()[0].interactable = false; left_log.GetComponentsInChildren<Text>()[0].text = "Select a spell to discard"; player_choice = player.Player_Spell_Book.Hand[0]; remove_indexs.Add(0); break; case "Spell_2": if (player_made_choice) { spell_2.GetComponentsInChildren<Image>()[0].color = red; spell_2.GetComponentsInChildren<Button>()[0].interactable = false; remove_indexs.Add(1); break; } spell_2.GetComponentsInChildren<Image>()[0].color = green; spell_2.GetComponentsInChildren<Button>()[0].interactable = false; left_log.GetComponentsInChildren<Text>()[0].text = "Select a spell to discard"; player_choice = player.Player_Spell_Book.Hand[1]; remove_indexs.Add(1); break; case "Spell_3": if (player_made_choice) { spell_3.GetComponentsInChildren<Image>()[0].color = red; spell_3.GetComponentsInChildren<Button>()[0].interactable = false; remove_indexs.Add(2); break; } spell_3.GetComponentsInChildren<Image>()[0].color = green; spell_3.GetComponentsInChildren<Button>()[0].interactable = false; left_log.GetComponentsInChildren<Text>()[0].text = "Select a spell to discard"; player_choice = player.Player_Spell_Book.Hand[2]; remove_indexs.Add(2); break; case "Spell_4": if (player_made_choice) { spell_4.GetComponentsInChildren<Image>()[0].color = red; spell_4.GetComponentsInChildren<Button>()[0].interactable = false; remove_indexs.Add(3); break; } spell_4.GetComponentsInChildren<Image>()[0].color = green; spell_4.GetComponentsInChildren<Button>()[0].interactable = false; left_log.GetComponentsInChildren<Text>()[0].text = "Select a spell to discard"; player_choice = player.Player_Spell_Book.Hand[3]; remove_indexs.Add(3); break; } if(player_made_choice) { remove_indexs.Sort(); player.Player_Spell_Book.Discard(remove_indexs[0]); player.Player_Spell_Book.Discard(remove_indexs[1]-1); current_state = BattleStates.ENEMYCHOICE; } player_made_choice = true; }
private void movePartyMemberAcrossLists(PartyMember partyMember, bool edgeListIndexIsZero, int nextListRelativeIndex, BattleStates.Think thinkState) { if (!party.Contains(partyMember)) return; List<PartyMember> list = GetListWithPartyMember(partyMember); int listIndex = layout.IndexOf(list); if (listIndex == (edgeListIndexIsZero ? 0 : layout.Count - 1)) // if the edge list return; List<PartyMember> nextList = layout[listIndex + nextListRelativeIndex]; int partyMemberPosition = Math.Min(list.IndexOf(partyMember), nextList.Count); list.Remove(partyMember); if (partyMemberPosition == 0 && nextList.Count > 0 && thinkState.PartyMemberHasCompletedThinkAction(nextList[partyMemberPosition])) { Weapon frontPartyMemberWeapon = nextList[partyMemberPosition].EquippedWeapon; if (frontPartyMemberWeapon != null && frontPartyMemberWeapon.Data.WeaponType == WeaponType.Melee) ++partyMemberPosition; } nextList.Insert(partyMemberPosition, partyMember); }
public StateChangedEventArgs(BattleStates newState) { NewState = newState; }
// Use this for initialization void Start() { currentState = BattleStates.START; }
public void Select_Finisher(string spell) { switch(spell) { case "combo": player_choice = combo_finisher_spell; break; case "reflect": player_choice = reflect_finisher_spell; break; case "affliction": player_choice = affliction_finisher_spell; break; } current_state = BattleStates.ENEMYCHOICE; }
public override void BeforeActUpdate(BattleStates.ThinkAction thinkAction, Delta delta) { if (beforeActFinished) return; base.BeforeActUpdate(thinkAction, delta); update(thinkAction.Actor, delta); if (shudderManager.Finished) beforeActFinished = true; }
void Start () { currentState = BattleStates.INIT; }