//*************** // Callbacks //*************** private void ShurikenSpeedCallbackWithPlayer(GameVar.players.player player) { if (OnShurikenSpeedChanged != null) { int shurikenSpeedPercent = Mathf.RoundToInt((player.speedMultiplier-1.0f)/(shurikenMaximumSpeed-1.0f)*100f); OnShurikenSpeedChanged(player, shurikenSpeedPercent); } }
/// <summary> /// Increases the shuriken speed over time for player. /// </summary> /// <param name="player">Player.</param> private void IncreaseShurikenSpeedOverTimeForPlayer(GameVar.players.player player) { if (player.speedMultiplier != shurikenMaximumSpeed) { if (player.speedMultiplier + ((shurikenMaximumSpeed - 1.0f) / (maxSpeedDuration / Time.deltaTime)) < shurikenMaximumSpeed) { player.speedMultiplier += ((shurikenMaximumSpeed - 1.0f) / (maxSpeedDuration / Time.deltaTime)); player.angle += angleDefaultValue * (((shurikenMaximumSpeed - 1.0f) / (maxSpeedDuration / Time.deltaTime))); } else { player.angle *= (shurikenMaximumSpeed / player.speedMultiplier); player.speedMultiplier = shurikenMaximumSpeed; } ShurikenSpeedCallbackWithPlayer (player); } }
/// <summary> /// Combos the debuff player. /// </summary> /// <param name="player">Player.</param> /// <param name="comboCounter">Combo counter.</param> private void ComboDebuffPlayer(GameVar.players.player player, int comboCounter) { if (OnComboDebuffPlayer != null) { OnComboDebuffPlayer (player); } if (consoleLog) { Debug.Log ("---GameFlow---"); } // Correctly debuffs only buffs aquired from combo buff method if (player.speedMultiplier - ((comboSpeedMultiplier - 1.0f) * comboCounter) > 1.0f) { // Speed multiplier player.speedMultiplier -= ((comboSpeedMultiplier - 1.0f) * comboCounter); // Player angle for (int i = 0; i < comboCounter; i++) { player.angle -= angleDefaultValue*(comboSpeedMultiplier-1.0f); } // Ensure player angle has minimum value if (player.angle < angleDefaultValue) { player.angle = angleDefaultValue; } // Ensure added speed over time stays active if (player.speedMultiplier <= 1.0f+addedSpeedOverTime) { player.speedMultiplier = 1.0f+addedSpeedOverTime; player.angle = 1.0f+angleDefaultValue*addedSpeedOverTime; } } else { // Ensure speed multiplier and player angle have minimum value; player.speedMultiplier = 1.0f; player.angle = angleDefaultValue; } ShurikenSpeedCallbackWithPlayer (player); // Log new values if (consoleLog) { Debug.Log("Combo debuff player: " + player + "\n" + " Player speed multiplier : " + player.speedMultiplier ); } }
/// <summary> /// Buffs the losing player. /// </summary> /// <param name="player">Player.</param> private void EnterDisadvantageBuffPhaseWithPlayer(GameVar.players.player player) { if (OnEnterDisadvantageBuffPlayerPhase != null) { OnEnterDisadvantageBuffPlayerPhase (player); } if (consoleLog) { Debug.Log ("---GameFlow---"); } isDisadvantageBuffLeftPhase = (player == GameVar.players.left); isDisadvantageBuffRightPhase = (player == GameVar.players.right); player.damageMultiplier += (disadvantageBuffDamageMultiplier-1.0f); // Log new values if (consoleLog) { Debug.Log("Buffed player: " + player + "\n" + " player damage multiplier : " + player.damageMultiplier ); } }
/// <summary> /// Combos the buff player. /// </summary> /// <param name="player">Player.</param> private void ComboBuffPlayer(GameVar.players.player player) { if (player.speedMultiplier < shurikenMaximumSpeed) { if (OnComboBuffPlayer != null) { OnComboBuffPlayer(player); } if (consoleLog) { Debug.Log ("---GameFlow---"); } if (player.speedMultiplier + (comboSpeedMultiplier - 1.0f) < shurikenMaximumSpeed) { player.speedMultiplier += (comboSpeedMultiplier - 1.0f); player.angle += angleDefaultValue*(comboSpeedMultiplier - 1.0f); } else { player.angle *= (shurikenMaximumSpeed/player.speedMultiplier); player.speedMultiplier = shurikenMaximumSpeed; } ShurikenSpeedCallbackWithPlayer(player); // Log new values if (consoleLog) { Debug.Log("Combo buff player: " + player + "\n" + " Player speed multiplier : " + player.speedMultiplier ); } } }