private void OnTriggerEnter2D(Collider2D other) { PlayerMovement movement = other.GetComponent <PlayerMovement>(); if (movement != null) { movement.AddMovementSpeed(duration, bonusSpeed, staminaReduction); Destroy(gameObject); playerCombat.shurikenAmount += shurikens; hud.UpdateShuriken(); } }
private void OnTriggerEnter2D(Collider2D other) { // Check if the player hits the trigger collider on the power up // if it is the player apply the upgrade and destroy the powerup. PlayerMovement movement = other.GetComponent <PlayerMovement>(); if (movement != null) { movement.AddMovementSpeed(duration, bonusSpeed, staminaReduction); playerCombat.shurikenAmount += shurikens; hud.UpdateShuriken(); Destroy(gameObject); } }
public void PlayerPowerMovementSpeed(PlayerMovement playerMovement, float addMovementSpeed, float timeMovement) { StartCoroutine(playerMovement.AddMovementSpeed(addMovementSpeed, timeMovement)); }