Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / Scripts / Player / Abilities / Dash.cs
@Rackday Rackday on 21 Aug 912 bytes Project Added
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. [CreateAssetMenu(menuName = "Abilities/Dash")]
  5. public class Dash : Abilities
  6. {
  7. [SerializeField]
  8. private float moveForce;
  9. [SerializeField]
  10. private float immortalityTimer;
  11. public override void Effects(PlayerController player)
  12. {
  13. Vector3 direction;
  14. Debug.Log(player.manaScript.mana > manaCost);
  15. if (player.manaScript.mana > manaCost)
  16. {
  17. if (player.zInput != 0 || player.xInput != 0)
  18. {
  19. player.manaScript.mana -= manaCost;
  20. direction = (player.transform.forward * player.zInput) + (player.transform.right * player.xInput);
  21. player.rb.velocity = direction * moveForce;
  22. player.healthScript.immortality = true;
  23. player.dashing = true;
  24. }
  25. }
  26. }
  27. }