Bumper Created

>Added a new Scene for testing King Abilities
>Added a Bumper Script that can be attached to objects to bump the
player away when hit
This commit is contained in:
Katherine 2021-10-11 13:35:30 -05:00
parent ed2467da85
commit 535ea75e08
6 changed files with 1509 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bc0fbc9ecc0433845b6684583bebf16e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 14595e0094b28384c8078f76053166e3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,15 @@
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
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 204dc1e4ca638924caabaa45df29d9d1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -12,7 +12,7 @@ public class PlayerMovement : MonoBehaviour
//Variable Section
/////
//Speed Variables
private Vector3 vel;
public Vector3 vel;
//Character Moving
private CharacterController moveController;