working on multiplayer
This commit is contained in:
7
Runtime/Engine/Code/Simulation/Sensors/ISensor.cs
Normal file
7
Runtime/Engine/Code/Simulation/Sensors/ISensor.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace RebootKit.Engine.Services.Simulation.Sensors {
|
||||
public interface ISensor {
|
||||
GameObject Sense();
|
||||
}
|
||||
}
|
||||
3
Runtime/Engine/Code/Simulation/Sensors/ISensor.cs.meta
Normal file
3
Runtime/Engine/Code/Simulation/Sensors/ISensor.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a25d318166444cdea14df9c89554436d
|
||||
timeCreated: 1740880690
|
||||
29
Runtime/Engine/Code/Simulation/Sensors/RaycastSensor.cs
Normal file
29
Runtime/Engine/Code/Simulation/Sensors/RaycastSensor.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace RebootKit.Engine.Services.Simulation.Sensors {
|
||||
public class RaycastSensor : ISensor {
|
||||
public LayerMask layerMask;
|
||||
public float maxDistance;
|
||||
public Ray ray;
|
||||
|
||||
public bool HasHit { get; private set; }
|
||||
public RaycastHit Hit { get; private set; }
|
||||
|
||||
public GameObject Sense() {
|
||||
HasHit = Physics.Raycast(ray, out RaycastHit hit, maxDistance, layerMask);
|
||||
|
||||
if (HasHit) {
|
||||
Hit = hit;
|
||||
return Hit.transform.gameObject;
|
||||
}
|
||||
|
||||
Hit = default;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void Clear() {
|
||||
HasHit = false;
|
||||
Hit = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b56194d1060a4b4da3e8a2acf7453a2f
|
||||
timeCreated: 1740880749
|
||||
Reference in New Issue
Block a user