mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-03-28 12:44:39 -05:00
28 lines
816 B
C#
28 lines
816 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Bumper : MonoBehaviour {
|
|
|
|
public float bumpPower = 30;
|
|
|
|
// Is called whenever something collides with the bumper
|
|
void OnTriggerEnter(Collider objectHit) {
|
|
if (objectHit.gameObject.tag == "ArcherTarget") {//Checks if the other object is the player
|
|
|
|
//Debug.Log("Bump");
|
|
MoveStateManager playerMovement = objectHit.GetComponent<MoveStateManager>();
|
|
|
|
Vector3 dirBump = objectHit.transform.position - transform.position;
|
|
|
|
dirBump.y = .1f;
|
|
if(dirBump.x == 0 && dirBump.z == 0){
|
|
dirBump = new Vector3(1,.1f,1);
|
|
}
|
|
|
|
playerMovement.GetHit(dirBump.normalized, bumpPower);
|
|
//
|
|
}
|
|
}
|
|
}
|