public void UpdateScore(int score) { model.score = model.score + score; OnUIUpdate.Invoke(model.health, model.score); //ServiceUI.Instance.updateUI(model.health, model.score); }
public Player(float x, float y) : base("PlayerSpriteSheet.png", 6, 1) { SetScaleXY(1f, 1f); SetXY(x, y); setupPlayer(x, y); onUIUpdateHandler += UpdateUI; }
public void TankHit(int damage) { model.TakeDamage(damage); OnUIUpdate.Invoke(model.health, model.score); if (!model.IsAlive()) { DestroyObject(); } //ServiceUI.Instance.updateUI(model.health, model.score); }
public void UpdateHype(bool hit) { bool playerTurn = _currentBattleStage == EBattleStage.PlayerMove; if (playerTurn) { if (hit) { if (correctInputCombo > 4) { hypeBarValue += 0.02f; BloomVolume.pullingUp = true; } else { hypeBarValue += 0.01f; BloomVolume.pullingUp = false; } correctInputCombo++; } else { hypeBarValue -= 0.05f; correctInputCombo = 0; } } else//enemy attack { if (hit) { if (correctInputCombo > 4) { hypeBarValue -= 0.02f; } else { hypeBarValue -= 0.01f; } correctInputCombo++; } else { hypeBarValue += 0.05f; correctInputCombo = 0; } } hypeBarValue = Mathf.Clamp(hypeBarValue, 0f, 1f); OnUIUpdate?.Invoke(false, false); }
public void ApplyDamage() { CharacterData attackingChar = null; CharacterData defendingChar = null; if (_lastToMoveIsPlayer) { attackingChar = player; defendingChar = enemy; } else { attackingChar = enemy; defendingChar = player; } float damage = 0; float tempoMultiplier = 1; if (_lastToMoveIsPlayer) { if (playerEffect == EMoveEffect.TempoUp) { tempoMultiplier += statsModifiers.SpeedEffectMultiplier; } if (playerEffect == EMoveEffect.PerformanceBased) { damage = statsModifiers.ExtraHypeDamage * hypeBarValue; damage += (currentMove.performanceDamage + currentMove.baseDamage) * statsModifiers.PerformanceModifier(attackingChar.GetCurveAPerformance()) * (currentmoveScore / currentMove.rythmData.Length); } else { damage = currentMove.baseDamage * statsModifiers.AtackModifier(attackingChar.GetCurveAttack()) + statsModifiers.ExtraHypeDamage * hypeBarValue; damage += currentMove.performanceDamage * tempoMultiplier * statsModifiers.PerformanceModifier(attackingChar.GetCurveAPerformance()) * (currentmoveScore / currentMove.rythmData.Length); } if (currentmoveScore == currentMove.rythmData.Length) { if (playerEffect == EMoveEffect.Perfection) { damage += currentMove.extraDamage * statsModifiers.PerfectionEffectMultiplier * statsModifiers.PerformanceModifier(attackingChar.GetCurveAPerformance()); } else { damage += currentMove.extraDamage * statsModifiers.PerformanceModifier(attackingChar.GetCurveAPerformance()); } } if (playerEffect == EMoveEffect.PerformanceBased) { damage *= statsModifiers.PerformanceBasedEffectMultiplier; } damage -= damage * statsModifiers.DefenseModifier(defendingChar.GetCurveDefense()); enemycurrenthealth -= damage; correctInputCombo = 0; StartCoroutine(DelayedNextTurn(true)); } else { if (enemyEffect == EMoveEffect.TempoUp) { tempoMultiplier += statsModifiers.SpeedEffectMultiplier; } if (enemyEffect == EMoveEffect.PerformanceBased) { damage = statsModifiers.ExtraHypeDamage * hypeBarValue; damage += (currentMove.performanceDamage + currentMove.baseDamage) * statsModifiers.PerformanceModifier(attackingChar.GetCurveAPerformance()) * (1 - (currentmoveScore / currentMove.rythmData.Length)); } else { damage = currentMove.baseDamage * statsModifiers.AtackModifier(attackingChar.GetCurveAttack()) + statsModifiers.ExtraHypeDamage * hypeBarValue; damage += currentMove.performanceDamage * tempoMultiplier * statsModifiers.PerformanceModifier(attackingChar.GetCurveAPerformance()) * (1 - (currentmoveScore / currentMove.rythmData.Length)); } if (currentmoveScore == 0) { if (enemyEffect == EMoveEffect.Perfection) { damage += currentMove.extraDamage * statsModifiers.PerfectionEffectMultiplier * statsModifiers.PerformanceModifier(attackingChar.GetCurveAPerformance()); } else { damage += currentMove.extraDamage * statsModifiers.PerformanceModifier(attackingChar.GetCurveAPerformance()); } } if (enemyEffect == EMoveEffect.PerformanceBased) { damage *= statsModifiers.PerformanceBasedEffectMultiplier; } damage -= damage * statsModifiers.DefenseModifier(defendingChar.GetCurveDefense()); playercurrenthealth -= damage; correctInputCombo = 0; StartCoroutine(DelayedNextTurn(false)); } if (_lastToMoveIsPlayer) { playerEffect = currentMove.effect; OnUIUpdate?.Invoke(true, false); } else { enemyEffect = currentMove.effect; OnUIUpdate?.Invoke(true, true); } AnimatorTest.hip_Hop_0 = false; Debug.Log(damage + " damage dealt"); BattleAudioController.Instance.FadeBackToMain(); }
public Player() : base("PlayerSpriteSheet.png", 6, 1) { onUIUpdateHandler += UpdateUI; }