IEnumerator Shake(float seconds, PF_GamePlay.ShakeEffects effect = PF_GamePlay.ShakeEffects.None) { yield return(new WaitForSeconds(seconds)); this.shaker.ResetToBeginning(); //new Vector3 (0,this.transform.position.y, this.transform.position.z); this.isShaking = false; this.shaker.enabled = false; if (effect == PF_GamePlay.ShakeEffects.DecreaseHealth) { int remainingHP = LifeBar.currentValue - this.pendingValue; yield return(StartCoroutine(LifeBar.UpdateBar(remainingHP))); if (remainingHP > 0) { StartCoroutine(PF_GamePlay.Wait(1.0f, () => { GameplayController.RaiseGameplayEvent(GlobalStrings.ENEMY_TURN_END_EVENT, PF_GamePlay.GameplayEventTypes.EnemyTurnEnds); })); } else { GameplayController.RaiseGameplayEvent(GlobalStrings.OUTRO_PLAYER_DEATH_EVENT, PF_GamePlay.GameplayEventTypes.OutroEncounter); } } else if (effect == PF_GamePlay.ShakeEffects.IncreaseHealth) { int remainingHP = LifeBar.currentValue + this.pendingValue; yield return(StartCoroutine(LifeBar.UpdateBar(remainingHP))); StartCoroutine(PF_GamePlay.Wait(.5f, () => { GameplayController.RaiseGameplayEvent(GlobalStrings.PLAYER_TURN_END_EVENT, PF_GamePlay.GameplayEventTypes.PlayerTurnEnds); })); } else if (effect == PF_GamePlay.ShakeEffects.DecreaseMana) { StartCoroutine(ManaBar.UpdateBar(LifeBar.currentValue - this.pendingValue)); } else if (effect == PF_GamePlay.ShakeEffects.IncreaseMana) { StartCoroutine(ManaBar.UpdateBar(LifeBar.currentValue + this.pendingValue)); } this.pendingValue = 0; yield break; }
IEnumerator Shake(float seconds, PF_GamePlay.ShakeEffects effect = PF_GamePlay.ShakeEffects.None) { yield return(new WaitForSeconds(seconds)); this.shaker.value = new Vector3(this.shaker.from.x + (this.shaker.to.x - this.shaker.from.x) / 2, this.shaker.from.y, this.shaker.from.z); this.isShaking = false; this.shaker.enabled = false; if (effect == PF_GamePlay.ShakeEffects.DecreaseHealth) { yield return(StartCoroutine(bar.UpdateBar(this.pendingValue))); if (this.pendingValue > 0) { StartCoroutine(PF_GamePlay.Wait(.5f, () => { GameplayController.RaiseGameplayEvent(GlobalStrings.PLAYER_TURN_END_EVENT, PF_GamePlay.GameplayEventTypes.PlayerTurnEnds); })); } else { GameplayController.RaiseGameplayEvent(GlobalStrings.OUTRO_ENEMY_DIED_EVENT, PF_GamePlay.GameplayEventTypes.OutroEncounter); } } else if (effect == PF_GamePlay.ShakeEffects.IncreaseHealth) { StartCoroutine(bar.UpdateBar(this.pendingValue)); } else if (effect == PF_GamePlay.ShakeEffects.DecreaseMana) { StartCoroutine(bar.UpdateBar(this.pendingValue)); } else if (effect == PF_GamePlay.ShakeEffects.IncreaseMana) { StartCoroutine(bar.UpdateBar(this.pendingValue)); } this.pendingValue = 0; yield break; }
public void Init() { UpdateQuestStats(); LifeBar.maxValue = PF_PlayerData.activeCharacter.PlayerVitals.Health; StartCoroutine(LifeBar.UpdateBar(PF_PlayerData.activeCharacter.PlayerVitals.Health, true)); }