Tp3 + start TP4
This commit is contained in:
parent
57a40d426b
commit
3a7ce962e7
112 changed files with 63386 additions and 45 deletions
35
TP3/Assets/Scripts/CarThings/speedZone.cs
Normal file
35
TP3/Assets/Scripts/CarThings/speedZone.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class speedZone : MonoBehaviour
|
||||
{
|
||||
[SerializeField] float speedBoost = 2.0f;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
// Can e be optimized with layers
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
CarMove car = other.GetComponent<CarMove>();
|
||||
if (car != null)
|
||||
{
|
||||
car.speedModifier = speedBoost;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
CarMove car = other.GetComponent<CarMove>();
|
||||
if (car != null)
|
||||
{
|
||||
car.speedModifier = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue