TheKingsRace/Assets/Scripts/KingScripts/KingAbilities/Bumper.cs
Katherine f20dbd6032 Implemented Hail and reoganised Abilities
>Hail is spawned at a rondom spot in an area
>Hail creates a Shadow directly underneath it
>Hail falls, and shadow scales to the correct size
>Abilites moved into their own folder
>King Implementation Scene Created and King Movement Created
2021-11-17 12:27:35 -06:00

16 lines
672 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bumper : MonoBehaviour {
// Is called whenever something collides with the bumper
void OnTriggerEnter(Collider other) {
//Debug.Log("Bump!");
GameObject player = other.gameObject;//Turns the collider into a game object
Vector3 DirBump = player.GetComponent<PlayerMovement>().vel * -1;//Inverts the Player Velocity
DirBump = Vector3.Normalize(DirBump);//Normalizes the vector to be used as a bump direction
player.GetComponent<PlayerMovement>().AddImpact(DirBump, 200); //Launches tthe player directly away from the bumper
}
}