mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-05-27 06:58:28 -05:00
>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
16 lines
672 B
C#
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
|
|
}
|
|
}
|