Class Projectile
Inheritance
object
UnityEngine.Object
UnityEngine.Component
UnityEngine.Behaviour
UnityEngine.MonoBehaviour
Mirror.NetworkBehaviour
Projectile
Assembly: Dew.Core.dll
Syntax
public abstract class Projectile : AbilityInstance, ILogicUpdate, ICleanup, ICustomDestroyRoutine
Fields
_estimatedVelocity
Declaration
protected Vector3 _estimatedVelocity
Field Value
| Type |
Description |
| UnityEngine.Vector3 |
|
canCollideMidFlight
Declaration
[BoxGroup("Projectile Settings", true, false, 0)]
[LabelText("Can Collide With Entity Mid-Flight")]
[ToggleLeft]
public bool canCollideMidFlight
Field Value
collisionRadius
Declaration
[Title("Collisions", null, TitleAlignments.Left, true, true)]
[BoxGroup("Projectile Settings", true, false, 0)]
public float collisionRadius
Field Value
collisionTargets
Declaration
[ShowIf("canCollideMidFlight", true)]
[BoxGroup("Projectile Settings", true, false, 0)]
public AbilityTargetValidator collisionTargets
Field Value
customEndHeight
Declaration
[ShowIf("@mode != Projectile.ProjectileMode.Target && !endsWithSameHeight", true)]
[BoxGroup("Projectile Settings", true, false, 0)]
public float customEndHeight
Field Value
destroyOnComplete
Declaration
[FormerlySerializedAs("killOnComplete")]
[BoxGroup("Projectile Settings", true, false, 0)]
public bool destroyOnComplete
Field Value
dissipateOnTerrain
Declaration
[BoxGroup("Projectile Settings", true, false, 0)]
[ToggleLeft]
public bool dissipateOnTerrain
Field Value
effectOnComplete
Declaration
[BoxGroup("Projectile Settings", true, false, 0)]
[LabelText("Complete")]
public GameObject effectOnComplete
Field Value
| Type |
Description |
| UnityEngine.GameObject |
|
effectOnDissipate
Declaration
[BoxGroup("Projectile Settings", true, false, 0)]
[LabelText("Dissipate")]
public GameObject effectOnDissipate
Field Value
| Type |
Description |
| UnityEngine.GameObject |
|
effectOnEntity
Declaration
[BoxGroup("Projectile Settings", true, false, 0)]
[LabelText("Entity")]
public GameObject effectOnEntity
Field Value
| Type |
Description |
| UnityEngine.GameObject |
|
effectOnFly
Declaration
[Title("Effects", null, TitleAlignments.Left, true, true)]
[BoxGroup("Projectile Settings", true, false, 0)]
[LabelText("Fly")]
public GameObject effectOnFly
Field Value
| Type |
Description |
| UnityEngine.GameObject |
|
endDistance
Declaration
[ShowIf("@mode == Projectile.ProjectileMode.Direction", true)]
[BoxGroup("Projectile Settings", true, false, 0)]
public float endDistance
Field Value
endsWithSameHeight
Declaration
[ShowIf("@mode != Projectile.ProjectileMode.Target", true)]
[BoxGroup("Projectile Settings", true, false, 0)]
public bool endsWithSameHeight
Field Value
horizontalOffsetOverTrajectory
Declaration
[LabelText("Horizontal Offset")]
[BoxGroup("Projectile Settings", true, false, 0)]
public AnimationCurve horizontalOffsetOverTrajectory
Field Value
| Type |
Description |
| UnityEngine.AnimationCurve |
|
killOnDissipate
Declaration
[BoxGroup("Projectile Settings", true, false, 0)]
public bool killOnDissipate
Field Value
mode
Declaration
[Title("Flight", null, TitleAlignments.Left, true, true)]
[EnumToggleButtons]
[BoxGroup("Projectile Settings", true, false, 0)]
public Projectile.ProjectileMode mode
Field Value
onEntity
Declaration
public SafeAction<Projectile.EntityHit> onEntity
Field Value
rotationType
Declaration
[LabelText("Rotation")]
[EnumToggleButtons]
[BoxGroup("Projectile Settings", true, false, 0)]
public Projectile.RotationType rotationType
Field Value
scaleHorizontalOffsetOnLength
Declaration
[LabelText("Scale On Trajectory Length")]
[BoxGroup("Projectile Settings", true, false, 0)]
public bool scaleHorizontalOffsetOnLength
Field Value
scaleVerticalOffsetOnLength
Declaration
[LabelText("Scale On Trajectory Length")]
[BoxGroup("Projectile Settings", true, false, 0)]
public bool scaleVerticalOffsetOnLength
Field Value
start
Declaration
[EnumToggleButtons]
[BoxGroup("Projectile Settings", true, false, 0)]
public Projectile.StartPositionType start
Field Value
startInFrontDistance
Declaration
[LabelText("Front Distance")]
[BoxGroup("Projectile Settings", true, false, 0)]
public float startInFrontDistance
Field Value
verticalOffsetOverTrajectory
Declaration
[LabelText("Vertical Offset")]
[BoxGroup("Projectile Settings", true, false, 0)]
public AnimationCurve verticalOffsetOverTrajectory
Field Value
| Type |
Description |
| UnityEngine.AnimationCurve |
|
Properties
isCompleted
Did this projectile complete its course?
Declaration
public bool isCompleted { get; }
Property Value
isFlying
Is this projectile still flying over its course?
Declaration
public bool isFlying { get; }
Property Value
targetEntity
Declaration
protected Entity targetEntity { get; }
Property Value
targetPosition
It is recommended to edit this only in OnPrepare.
Declaration
protected Vector3 targetPosition { get; set; }
Property Value
| Type |
Description |
| UnityEngine.Vector3 |
|
Methods
AddEffect(AddEffectTarget, GameObject)
Locally add an effect.
Given effect will be instantiated and set/added to this projectile.
Declaration
public void AddEffect(Projectile.AddEffectTarget target, GameObject eff)
Parameters
CalculateOffsetOverTrajectoryInWorldSpace(float, Quaternion)
Declaration
protected Vector3 CalculateOffsetOverTrajectoryInWorldSpace(float normalizedPosition, Quaternion rotation)
Parameters
| Type |
Name |
Description |
| float |
normalizedPosition |
|
| UnityEngine.Quaternion |
rotation |
|
Returns
| Type |
Description |
| UnityEngine.Vector3 |
|
CheckForCompletion()
Declaration
protected virtual bool CheckForCompletion()
Returns
Dissipate()
Dissipate this projectile.
Declaration
FrameUpdate()
Declaration
public override void FrameUpdate()
Overrides
GetTargetWorldPosition()
Declaration
protected virtual Vector3 GetTargetWorldPosition()
Returns
| Type |
Description |
| UnityEngine.Vector3 |
|
LogicUpdate(float)
Declaration
public override void LogicUpdate(float dt)
Parameters
| Type |
Name |
Description |
| float |
dt |
|
Overrides
OnComplete()
Called on server when this Projectile fully completes its path without being despawned by itself/dissipated.
Default behaviour instantiates a new effectOnComplete effect using the position and rotation of this projectile on every clients, and stops effectOnFly effect.
It will also kill this projectile if killOnComplete is set.
Note: On targeted projectiles, normally OnEntity will be fired before OnComplete. It might fire differently if for example the projectile is detached or the target became an invalid target.
Declaration
protected virtual void OnComplete()
OnCreate()
Declaration
protected override void OnCreate()
Overrides
OnDestroyActor()
Declaration
protected override void OnDestroyActor()
Overrides
OnDisable()
Declaration
protected override void OnDisable()
Overrides
OnDissipate()
Called on server when this Projectile is dissipated by an outer source. e.g. Projectile Absorbing Wall
Default behaviour instantiates a new effectOnDissipate effect using the position and rotation of this projectile on every clients
Declaration
protected virtual void OnDissipate()
OnEntity(EntityHit)
Called on server when this Projectile in server detects a collision with an Entity.
Default behaviour instantiates a new effectOnEntity effect at the hit point with the rotation of this projectile attached to the entity on every clients.
Declaration
protected virtual void OnEntity(Projectile.EntityHit hit)
Parameters
OnPrepare()
Declaration
protected override void OnPrepare()
Overrides
OnStartServer()
Declaration
public override void OnStartServer()
Overrides
PositionSolver(float)
Declaration
protected abstract Vector3 PositionSolver(float dt)
Parameters
| Type |
Name |
Description |
| float |
dt |
|
Returns
| Type |
Description |
| UnityEngine.Vector3 |
|
RotationSolver(float)
Declaration
protected virtual Quaternion RotationSolver(float dt)
Parameters
| Type |
Name |
Description |
| float |
dt |
|
Returns
| Type |
Description |
| UnityEngine.Quaternion |
|
SetCustomStartPosition(Vector3)
Set custom start position for projectiles with 'Custom' start position mode. Call this in OnPrepare.
Declaration
public void SetCustomStartPosition(Vector3 pos)
Parameters
| Type |
Name |
Description |
| UnityEngine.Vector3 |
pos |
|
Exceptions
| Type |
Condition |
| System.InvalidOperationException |
|
StopFlying()
Stop this projectile and its effectOnFly effect. This will also make this projectile instantly stop checking collisions. Note that this does not call OnComplete nor OnDissipate.
Declaration
protected void StopFlying()
Implements
Extension Methods