Add this class to a weapon and it'll prevent shooting when close to an obstacle (as defined by the ObstacleLayerMask)
More...
|
| override bool | ShootingAllowed () |
| | Shooting is allowed if no obstacle is in front of the weapon.
|
| bool | ShootingAllowed () |
| | Override this method to define shooting conditions.
|
|
| float | Angle = 5f |
| | the angle to consider when deciding whether or not there's a wall in front of the weapon (usually 5 degrees is fine)
|
| float | Distance = 2f |
| | the max distance to the wall we want to prevent shooting from
|
| Vector3 | RaycastOriginOffset = Vector3.zero |
| | the offset to apply to the detection (in addition and relative to the weapon's position)
|
| LayerMask | ObstacleLayerMask = LayerManager.ObstaclesLayerMask |
| | the layers to consider as obstacles
|
|
| virtual void | Awake () |
| | On Awake we grab our weapon.
|
| virtual bool | CheckForObstacles () |
| | Casts rays in front of the weapon to check for obstacles Returns true if an obstacle was found.
|
Add this class to a weapon and it'll prevent shooting when close to an obstacle (as defined by the ObstacleLayerMask)
◆ Awake()
| virtual void MoreMountains.TopDownEngine.WeaponPreventShootingWhenCloseToWalls2D.Awake |
( |
| ) |
|
|
protectedvirtual |
On Awake we grab our weapon.
◆ CheckForObstacles()
| virtual bool MoreMountains.TopDownEngine.WeaponPreventShootingWhenCloseToWalls2D.CheckForObstacles |
( |
| ) |
|
|
protectedvirtual |
Casts rays in front of the weapon to check for obstacles Returns true if an obstacle was found.
- Returns
◆ ShootingAllowed()
| override bool MoreMountains.TopDownEngine.WeaponPreventShootingWhenCloseToWalls2D.ShootingAllowed |
( |
| ) |
|
Shooting is allowed if no obstacle is in front of the weapon.
- Returns
◆ _hitLeft
| RaycastHit2D MoreMountains.TopDownEngine.WeaponPreventShootingWhenCloseToWalls2D._hitLeft |
|
protected |
◆ _hitMiddle
| RaycastHit2D MoreMountains.TopDownEngine.WeaponPreventShootingWhenCloseToWalls2D._hitMiddle |
|
protected |
◆ _hitRight
| RaycastHit2D MoreMountains.TopDownEngine.WeaponPreventShootingWhenCloseToWalls2D._hitRight |
|
protected |
◆ _weaponAim
| WeaponAim MoreMountains.TopDownEngine.WeaponPreventShootingWhenCloseToWalls2D._weaponAim |
|
protected |
◆ Angle
| float MoreMountains.TopDownEngine.WeaponPreventShootingWhenCloseToWalls2D.Angle = 5f |
the angle to consider when deciding whether or not there's a wall in front of the weapon (usually 5 degrees is fine)
◆ Distance
| float MoreMountains.TopDownEngine.WeaponPreventShootingWhenCloseToWalls2D.Distance = 2f |
the max distance to the wall we want to prevent shooting from
◆ ObstacleLayerMask
| LayerMask MoreMountains.TopDownEngine.WeaponPreventShootingWhenCloseToWalls2D.ObstacleLayerMask = LayerManager.ObstaclesLayerMask |
the layers to consider as obstacles
◆ RaycastOriginOffset
| Vector3 MoreMountains.TopDownEngine.WeaponPreventShootingWhenCloseToWalls2D.RaycastOriginOffset = Vector3.zero |
the offset to apply to the detection (in addition and relative to the weapon's position)
The documentation for this class was generated from the following file: