TopDown Engine v4.5
Loading...
Searching...
No Matches
MoreMountains.TopDownEngine.WeaponLaserSight Class Reference

Add this class to a weapon and it'll project a laser ray towards the direction the weapon is facing. More...

Inheritance diagram for MoreMountains.TopDownEngine.WeaponLaserSight:
MoreMountains.TopDownEngine.TopDownMonoBehaviour MoreMountains.Tools.MMMonoBehaviour

Public Types

enum  Modes { TwoD , ThreeD }
 the possible modes this weapon laser sight can run on, 3D by default More...

Public Member Functions

virtual void ShootLaser ()
 Draws the actual laser.
virtual void LaserActive (bool status)
 Turns the laser on or off depending on the status passed in parameters.

Public Attributes

Modes Mode = Modes.ThreeD
 whether this laser should work in 2D or 3D
bool PerformRaycast = true
 if this is false, raycasts won't be computed for this laser sight
bool DrawLaser = true
 if this is false, the laser won't be drawn
Vector3 RaycastOriginOffset
 the origin of the raycast used to detect obstacles
Vector3 LaserOriginOffset
 the origin of the visible laser
float LaserMaxDistance = 50
 the maximum distance to which we should draw the laser
LayerMask LaserCollisionMask
 the collision mask containing all layers that should stop the laser
Vector2 LaserWidth = new Vector2(0.05f, 0.05f)
 the width of the laser
Material LaserMaterial
 the material used to render the laser
RaycastHit2D _hit2D

Protected Member Functions

virtual void Start ()
 Initialization.
virtual void Initialization ()
 On init we create our line if needed.
virtual void LateUpdate ()
 Every frame we draw our laser.

Protected Attributes

Vector3 _destination
Vector3 _laserOffset
Weapon _weapon
Vector3 _direction
Vector3 _weaponPosition
Vector3 _thisPosition
Vector3 _thisForward
Quaternion _weaponRotation
Quaternion _thisRotation
int _initFrame

Properties

virtual LineRenderer _line [get, protected set]
virtual RaycastHit _hit [get, protected set]
virtual Vector3 _origin [get, protected set]
virtual Vector3 _raycastOrigin [get, protected set]

Detailed Description

Add this class to a weapon and it'll project a laser ray towards the direction the weapon is facing.

Member Enumeration Documentation

◆ Modes

the possible modes this weapon laser sight can run on, 3D by default

Enumerator
TwoD 
ThreeD 

Member Function Documentation

◆ Initialization()

virtual void MoreMountains.TopDownEngine.WeaponLaserSight.Initialization ( )
protectedvirtual

On init we create our line if needed.

◆ LaserActive()

virtual void MoreMountains.TopDownEngine.WeaponLaserSight.LaserActive ( bool status)
virtual

Turns the laser on or off depending on the status passed in parameters.

Parameters
statusIf set to true status.

◆ LateUpdate()

virtual void MoreMountains.TopDownEngine.WeaponLaserSight.LateUpdate ( )
protectedvirtual

Every frame we draw our laser.

◆ ShootLaser()

virtual void MoreMountains.TopDownEngine.WeaponLaserSight.ShootLaser ( )
virtual

Draws the actual laser.

◆ Start()

virtual void MoreMountains.TopDownEngine.WeaponLaserSight.Start ( )
protectedvirtual

Initialization.

Member Data Documentation

◆ _destination

Vector3 MoreMountains.TopDownEngine.WeaponLaserSight._destination
protected

◆ _direction

Vector3 MoreMountains.TopDownEngine.WeaponLaserSight._direction
protected

◆ _hit2D

RaycastHit2D MoreMountains.TopDownEngine.WeaponLaserSight._hit2D

◆ _initFrame

int MoreMountains.TopDownEngine.WeaponLaserSight._initFrame
protected

◆ _laserOffset

Vector3 MoreMountains.TopDownEngine.WeaponLaserSight._laserOffset
protected

◆ _thisForward

Vector3 MoreMountains.TopDownEngine.WeaponLaserSight._thisForward
protected

◆ _thisPosition

Vector3 MoreMountains.TopDownEngine.WeaponLaserSight._thisPosition
protected

◆ _thisRotation

Quaternion MoreMountains.TopDownEngine.WeaponLaserSight._thisRotation
protected

◆ _weapon

Weapon MoreMountains.TopDownEngine.WeaponLaserSight._weapon
protected

◆ _weaponPosition

Vector3 MoreMountains.TopDownEngine.WeaponLaserSight._weaponPosition
protected

◆ _weaponRotation

Quaternion MoreMountains.TopDownEngine.WeaponLaserSight._weaponRotation
protected

◆ DrawLaser

bool MoreMountains.TopDownEngine.WeaponLaserSight.DrawLaser = true

if this is false, the laser won't be drawn

◆ LaserCollisionMask

LayerMask MoreMountains.TopDownEngine.WeaponLaserSight.LaserCollisionMask

the collision mask containing all layers that should stop the laser

◆ LaserMaterial

Material MoreMountains.TopDownEngine.WeaponLaserSight.LaserMaterial

the material used to render the laser

◆ LaserMaxDistance

float MoreMountains.TopDownEngine.WeaponLaserSight.LaserMaxDistance = 50

the maximum distance to which we should draw the laser

◆ LaserOriginOffset

Vector3 MoreMountains.TopDownEngine.WeaponLaserSight.LaserOriginOffset

the origin of the visible laser

◆ LaserWidth

Vector2 MoreMountains.TopDownEngine.WeaponLaserSight.LaserWidth = new Vector2(0.05f, 0.05f)

the width of the laser

◆ Mode

Modes MoreMountains.TopDownEngine.WeaponLaserSight.Mode = Modes.ThreeD

whether this laser should work in 2D or 3D

◆ PerformRaycast

bool MoreMountains.TopDownEngine.WeaponLaserSight.PerformRaycast = true

if this is false, raycasts won't be computed for this laser sight

◆ RaycastOriginOffset

Vector3 MoreMountains.TopDownEngine.WeaponLaserSight.RaycastOriginOffset

the origin of the raycast used to detect obstacles

Property Documentation

◆ _hit

virtual RaycastHit MoreMountains.TopDownEngine.WeaponLaserSight._hit
getprotected set

◆ _line

virtual LineRenderer MoreMountains.TopDownEngine.WeaponLaserSight._line
getprotected set

◆ _origin

virtual Vector3 MoreMountains.TopDownEngine.WeaponLaserSight._origin
getprotected set

◆ _raycastOrigin

virtual Vector3 MoreMountains.TopDownEngine.WeaponLaserSight._raycastOrigin
getprotected set

The documentation for this class was generated from the following file:
  • H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/Common/Scripts/Characters/Weapons/WeaponLaserSight.cs