mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-04-26 02:00:54 -05:00
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:
parent
ed2467da85
commit
535ea75e08
1467
Assets/Scenes/KingAbilitesTest.unity
Normal file
1467
Assets/Scenes/KingAbilitesTest.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/KingAbilitesTest.unity.meta
Normal file
7
Assets/Scenes/KingAbilitesTest.unity.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bc0fbc9ecc0433845b6684583bebf16e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/KingAbilities.meta
Normal file
8
Assets/Scripts/KingAbilities.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 14595e0094b28384c8078f76053166e3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
15
Assets/Scripts/KingAbilities/Bumper.cs
Normal file
15
Assets/Scripts/KingAbilities/Bumper.cs
Normal 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
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/KingAbilities/Bumper.cs.meta
Normal file
11
Assets/Scripts/KingAbilities/Bumper.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 204dc1e4ca638924caabaa45df29d9d1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -12,7 +12,7 @@ public class PlayerMovement : MonoBehaviour
|
|||
//Variable Section
|
||||
/////
|
||||
//Speed Variables
|
||||
private Vector3 vel;
|
||||
public Vector3 vel;
|
||||
|
||||
//Character Moving
|
||||
private CharacterController moveController;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user