emitter model
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
using System;
|
||||
using NaughtyAttributes;
|
||||
using Station46.Scripts;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Station46.Modules.Laser.Scripts
|
||||
{
|
||||
[RequireComponent(typeof(Emission))]
|
||||
public class Laser : MonoBehaviour
|
||||
{
|
||||
private const float MaxDistance = 1000;
|
||||
|
||||
public bool firing;
|
||||
[BoxGroup("Internal")] [SerializeField] private Transform laserStart;
|
||||
[BoxGroup("Internal")] [SerializeField] private Emission emission;
|
||||
[BoxGroup("Internal")] [SerializeField] private LineRenderer laserLineRenderer;
|
||||
|
||||
|
||||
private LaserReceiver CurrentReceiver
|
||||
{
|
||||
get => _currentReceiver;
|
||||
@@ -45,14 +49,15 @@ namespace Station46.Modules.Laser.Scripts
|
||||
protected virtual void Update()
|
||||
{
|
||||
laserLineRenderer.enabled = firing;
|
||||
|
||||
emission.active = firing;
|
||||
|
||||
if (firing && Physics.Raycast(
|
||||
laserStart.position,
|
||||
transform.TransformDirection(Vector3.forward),
|
||||
out var hit,
|
||||
MaxDistance,
|
||||
~0,
|
||||
QueryTriggerInteraction.Ignore
|
||||
laserStart.position,
|
||||
transform.TransformDirection(Vector3.forward),
|
||||
out var hit,
|
||||
MaxDistance,
|
||||
~0,
|
||||
QueryTriggerInteraction.Ignore
|
||||
))
|
||||
{
|
||||
SetHitPosition(hit.distance);
|
||||
|
||||
Reference in New Issue
Block a user