void InitFightPanel() { Skinning.ResetSkin(selectedSkin); if (fightManager == null) { Debug.LogError(debuguableInterface.debugLabel + "FightManager component shouldn't be null. If we can't get scene references we can't do anything."); } EnemyBundle bundle = gameData.enemyContent.Find(item => { return(item.enemy == actualEnemy); }); CombatDialogue selectedCombat = bundle.combatDialogue; actualTutorial.Init(() => { fightManager.Init( useCheats, bundle.punchlines, bundle.shogunDialogue, audioProjectManager, () => { panelManager.JumpTo(GamePhase.CONSEQUENCES, () => consequencesManager = FindObjectOfType <ConsequencesManager>()); audioProjectManager.FadeMusicOut(1); } ); }); }
public void PreInit(CombatDialogue actualCombat) { // assign backgrounds for (int i = 0; i < backgrounds.Length; i++) { backgrounds[i].sprite = actualCombat.sceneBackgrounds[i]; backgrounds[i].color = ColorTools.LerpColorValues(Skinning.GetSkin(backgrounds[i].GetComponent <SkinGraphic>().skin_tag), ColorTools.Value.SV, new int[2] { backgroundSvalue, backgroundVvalue }); backgrounds[i].GetComponent <SkinGraphic>().enabled = false; } this.actualCombat = actualCombat; enemyHealth = new List <SubCategory>(actualCombat.weaknesses); enemyGraph.sprite = actualCombat.enemySprites[4 + enemyHealth.Count]; bigEnemyGraph.sprite = enemyGraph.sprite; playerGraph.sprite = playerSprites[0]; actualPhase = Phase.INTRO; if (actualCombat.actualState == GameData.GameState.GAME_OVER_FINISHER) { enemyHealth.Clear(); enemyGraph.sprite = actualCombat.enemySprites[4]; } }
public void ActivateAbility(int A) { Debug.Log("Activated Ability: " + PlayerAbilities[A].name); _Player.GetComponent <Animator>().runtimeAnimatorController = PlayerAbilities[A].Animator; _Ability1.SetActive(false); _Ability2.SetActive(false); _Ability3.SetActive(false); _Ability4.SetActive(false); _EnemyParent.SendMessage("TakeDamage", PlayerAbilities[A].Damage - StartingEnemy.Defense - EnemyDefendDefense); if (PlayerAbilities[A].DebuffMessage != "") { this.gameObject.SendMessage(PlayerAbilities[A].DebuffMessage, false); } if (PlayerAbilities[A].IsIsolatedText == false) { CombatDialogue.GetComponent <TextMeshProUGUI>().text = "Crono " + PlayerAbilities[A].CombatText + " " + StartingEnemy.Name; } if (PlayerAbilities[A].IsIsolatedText == true) { CombatDialogue.GetComponent <TextMeshProUGUI>().text = "Crono " + PlayerAbilities[A].CombatText; } State = States.Idle; PlayerTurn = false; }
// called when we get to the shogun panel void InitShogunPanel() { Skinning.ResetSkin(selectedSkin); if (shogunManager == null) { Debug.LogError(debuguableInterface.debugLabel + "ShogunManager component shouldn't be null. If we can't get scene references we can't do anything."); return; } EnemyBundle bundle = gameData.enemyContent.Find(item => { return(item.enemy == actualEnemy); }); GeneralDialogue selectedGeneral = bundle.shogunDialogue; selectedGeneral.Init(); CombatDialogue selectedCombat = bundle.combatDialogue; shogunManager.Init(useCheats, () => { popupManager.Pop(GamePopup.SHOGUN_DEDUCTION); audioProjectManager.FadeMusicOut(); }, audioProjectManager.FadePopupMusicIn); popupManager.GetPopupFromType <ShogunPopup>().SpecificInit( useCheats, selectedGeneral.GetAllClues(), selectedGeneral.unlockableConclusions, shogunManager.characters, selectedGeneral.goodDeityFeedback, selectedGeneral.badDeityFeedback, () => { popupManager.CancelPop(); audioProjectManager.FadeMusicIn(); }, () => { audioProjectManager.FadeMusicOut(); audioProjectManager.FadePopupMusicOut(); panelManager.JumpTo(GamePhase.FIGHT, () => { fightManager = FindObjectOfType <FightManager>(); fightManager.PreInit(selectedCombat); audioProjectManager.FadeMusicOut(); }); }, selectedCombat.actualState ); if (selectedCombat.actualState == GameState.NORMAL) { gameData.ResetPlayerClues(); } actualTutorial.Init(() => shogunManager.StartDialogue(selectedGeneral)); }
void InitConsequencesPanel() { Skinning.ResetSkin(selectedSkin); if (consequencesManager == null) { Debug.LogError(debuguableInterface.debugLabel + "ConsequencesManager component shouldn't be null. If we can't get scene references we can't do anything."); } EnemyBundle bundle = gameData.enemyContent.Find(item => { return(item.enemy == actualEnemy); }); CombatDialogue selectedCombat = bundle.combatDialogue; string textToShow = string.Empty; switch (selectedCombat.actualState) { case GameData.GameState.GAME_OVER_GENERAL: textToShow = bundle.combatDialogue.playerLoseGeneralConsequence; break; case GameData.GameState.GAME_OVER_FINISHER: textToShow = bundle.combatDialogue.playerLoseFinalConsequence; break; default: textToShow = bundle.combatDialogue.playerWinConsequence; break; } consequencesManager.Init( selectedCombat.actualState, (int)actualEnemy, () => panelManager.JumpTo(GamePhase.END, () => { endManager = FindObjectOfType <EndManager>(); audioProjectManager.FadeMusicOut(); }), () => panelManager.JumpTo(GamePhase.SHOGUN, () => { shogunManager = FindObjectOfType <ShogunManager>(); shogunManager.PreInit( selectedCombat.actualState, gameData.enemyContent.Find(item => { return(item.enemy == actualEnemy); }).shogunDialogue, AddClueToPlayer ); audioProjectManager.FadeMusicOut(); }), () => panelManager.JumpTo(GamePhase.FIGHT, () => { fightManager = FindObjectOfType <FightManager>(); fightManager.PreInit(selectedCombat); audioProjectManager.FadeMusicOut(); }), () => actualEnemy++, textToShow ); }
void DecideEnemyAction() { if (EnemyHealthBar.GetComponent <Image>().fillAmount > .5) { if (Random.Range(0, 100) > 75) { EnemyDecidedAttack = 1; _EnemyParent.GetComponent <Animator>().runtimeAnimatorController = StartingEnemy.DefenseAbility.Animator; CombatDialogue.GetComponent <TextMeshProUGUI>().text = StartingEnemy.DefenseAbility.CombatText; EnemyDefendDefense = 0.1f; if (StartingEnemy.DefenseAbility.Healing > 0) { _EnemyParent.SendMessage("Heal", StartingEnemy.DefenseAbility.Healing); } PlayerTurn = true; State = States.Idle; return; } else { EnemyDecidedAttack = 0; _EnemyParent.GetComponent <Animator>().runtimeAnimatorController = StartingEnemy.BasicAttack.Animator; CombatDialogue.GetComponent <TextMeshProUGUI>().text = StartingEnemy.BasicAttack.CombatText; State = States.Idle; PlayerTurn = true; return; } } if (EnemyHealthBar.GetComponent <Image>().fillAmount < .5) { if (EnemySignatureCharges > 0) { EnemyDecidedAttack = 3; EnemySignatureCharges--; _EnemyParent.GetComponent <Animator>().runtimeAnimatorController = StartingEnemy.SignatureAbility.Animator; CombatDialogue.GetComponent <TextMeshProUGUI>().text = StartingEnemy.SignatureAbility.CombatText; if (StartingEnemy.SignatureAbility.Healing > 0) { _EnemyParent.SendMessage("Heal", StartingEnemy.SignatureAbility.Healing); } PlayerTurn = true; State = States.Idle; return; } if (EnemySignatureCharges <= 0) { if (Random.Range(0, 100) > 70) { EnemyDecidedAttack = 2; _EnemyParent.GetComponent <Animator>().runtimeAnimatorController = StartingEnemy.UtilityAbility.Animator; CombatDialogue.GetComponent <TextMeshProUGUI>().text = StartingEnemy.UtilityAbility.CombatText; PlayerTurn = true; State = States.Idle; return; } else { EnemyDecidedAttack = 0; _EnemyParent.GetComponent <Animator>().runtimeAnimatorController = StartingEnemy.BasicAttack.Animator; CombatDialogue.GetComponent <TextMeshProUGUI>().text = StartingEnemy.BasicAttack.CombatText; State = States.Idle; PlayerTurn = true; return; } } } }
// Update is called once per frame void FixedUpdate() { if (_Enemy.GetComponent <SpriteRenderer>().sprite == null) { _Enemy.GetComponent <SpriteRenderer>().sprite = StartingEnemy.DefaultSprite; } switch (State) { case States.Idle: if (EnemyBarFill.fillAmount <= 0) { State = States.EndingCombat; CombatDialogue.GetComponent <TextMeshProUGUI>().text = "You have Won The Battle!"; PlayerWin = true; } if (PlayerBarFill.fillAmount <= 0) { State = States.EndingCombat; CombatDialogue.GetComponent <TextMeshProUGUI>().text = "You have Died!"; PlayerDefeat = true; } IdleCount++; if (IdleCount > 100) { if (PlayerTurn) { State = States.PlayerTurn; _Ability1.SetActive(true); _Ability2.SetActive(true); _Ability3.SetActive(true); _Ability4.SetActive(true); CombatDialogue.GetComponent <TextMeshProUGUI>().text = " "; IdleCount = 0; } if (PlayerTurn == false) { State = States.EnemyTurn; IdleCount = 0; } } break; case States.PlayerTurn: DefendDefense = 0; break; case States.EnemyTurn: EnemyDefendDefense = 0; DecideEnemyAction(); break; case States.EndingCombat: if (PlayerWin) { EndingCount++; if (EndingCount > 250) { GameObject o = GameObject.Find("PersistentManager"); float f = Random.Range(0.2f, 0.3f); o.GetComponent <PersistentManager>().ExpWaiting = f; SceneManager.LoadScene(1); } } break; case States.CombatEnd: break; default: break; } }