A Skill, something an Actor can perform. This can be a lot of things and can range from attack skills like the swing of a sword or a fireball to the use of a pick to mind for some ore. The plyBlox system does most of the work when events related to the Skill is triggered. More...
Inherits MonoBehaviour.
Public Member Functions | |
override string | ToString () |
void | CopyTo (Skill o) |
virtual void | Execute (Targetable selectedObject, Vector3 selectedPosition, Vector3 mousePosition) |
Tell Skill to execute now More... | |
bool | IsExecuting () |
Return true if the Skill is busy being executed. All skills are "instant" in creating their effects and only executionTime govern the Executing status. More... | |
bool | CoolingDown () |
Return true if busy with cool-down More... | |
bool | IsReady () |
Return true if ready to execute and not on some cool down or being prevented in some other way. More... | |
bool | FacingAcceptable (Vector3 currForward, Vector3 targetPos, Vector3 mousePos, out Vector3 wantedDirection) |
Return true if the facing is within acceptable range. The returned wantedDirection can be used to turn character to correct facing if needed. More... | |
bool | DistanceAcceptable (Vector3 currPos, Vector3 targetPos, Vector3 mousePos, out Vector3 wantedPos) |
Return true if the distance from target/ point is fine and skill can be executed. wantedPos is the target point that should be moved towards while continuously calling this function to check if in range yet. More... | |
void | ExecuteSecondary (Vector3 atLocation, Targetable ignore) |
Trigger the Skill's secondary effect at specified location. Can also specify a a targetable object to ignore when finding targets. More... | |
void | ExecuteFizzleEvent (Vector3 pos, bool wasObstacle) |
Ask Skill to call the Fizzle event in plyBlox More... | |
bool | AttemptHit (GameObject onObject, Vector3 hitPos) |
Called by Projectile to attempt hit on object. Return false if was invalid target. More... | |
Targetable | FindValidTargetAt (Ray ray) |
Try and find first valid target that falls in the ray. Normally the ray comes from a mouse position to check if there is a valid target under the mouse cursor. More... | |
bool | IsValidTargetableType (Targetable target) |
Return true of the target is a valid targetable type for the skill, according to the skill's settings. More... | |
bool | IsValidTargetable (Targetable target, Transform checkTr, Vector3 checkFrom, float checkHeight, LayerMask checkMask) |
First call IsValidTargetableType() and if that is fine it will check if there is an obstacle between the target and the checkTr position or checkFrom position of checkTr is null. The checkHeight is an offset from the checkTr or checkFrom positions and checkMask is the layers considered to be obstacles. More... | |
Public Attributes | |
bool | showDebugInfo = false |
CommonDefinitionData | def = new CommonDefinitionData() |
common data | |
UniqueID | id = new UniqueID() |
Unique id. | |
plyBlox | blox |
The blox object of this skill. | |
float | executionTimeout = 0f |
(seconds) how long it takes to execute the skill. In this time the actor can't start a new skill | |
float | cooldownTimeout = 1f |
(seconds) how long before the skill can be used again after being used | |
bool | mayPerformWhileMove = true |
Actor may perform skill while moving? | |
bool | forceStop = true |
Only used when Perform While Move is set to False. This will force the character to stop so it can perform the skill. | |
bool | canBeQueued = true |
Set to false to prevent this skill from being queued. It can then only be used if the Actor is not currently using another Skill. | |
Activation | activation = Activation.User |
How a skill is activated. | |
DeliveryMethod | deliveryMethod = DeliveryMethod.Instant |
How the skill's effect is delivered. | |
TargetingMethod | targetingMethodMask = TargetingMethod.Auto |
How does skill collect possible targets. | |
ValidTargets | validTargetsMask = 0 |
What are valid targets for the skill's effect. | |
TargetLocation | targetLocation = TargetLocation.ActorDirection |
In what direction or location the skill is executed. | |
int | maxEffects = 1 |
for instant this is max targets to select. for projectiles this will be the max projectiles that can be created (and targets that would be selected if in that mode) | |
float | targetingDistance = 2 |
(meters) how far to select targets from self (also used for how far projectile will move before fizzle) | |
int | targetingAngle = 45 |
(degrees) at hat angle from self's forward may targets be selected | |
int | targetingRadius = 5 |
(meters) used with the detection circle when AtClickPosition used | |
LayerMask | obstacleCheckMask = 0 |
check if something is between target and skill user? | |
float | obstacbleCheckHeight = 1.5f |
Ray is cast from this height. | |
float | instantHitDelay = 0f |
Set to have DeliveryMethod.Instant delay before creating its Hit Event. | |
int | secondaryMaxTargets = 0 |
could be used for splash damage (disabled when set to 0) | |
int | secondaryRadius = 5 |
detection radius in meters | |
LayerMask | secondaryObstacleCheckMask = 0 |
check if something is between target and effect execution position? | |
float | secondaryObstacbleCheckHeight = 1.5f |
Ray is cast from this height. | |
GameObject[] | projectileFabs = new GameObject[5] |
prefabs of projectile. Will choose randomly from these. | |
float | projectileCreateDelay = 0f |
how long to wait before creating the (1st) projectile | |
float | projectileCreateDelayBetween = 0f |
how long to delay between creating projectiles | |
ProjectileMoveMethod | projectileMoveMethod = ProjectileMoveMethod.ActorFaceDirection |
How does a projectile move. | |
bool | moveMethod_b_opt = false |
ProjectileMoveMethod.DirectToTarget: heat-seeking? ProjectileMoveMethod.AngledFromEach: random angle? | |
bool | useVectorOffset = true |
if true, use projectileCreateOffset else projectileCreateAtTagged | |
Vector3 | projectileCreateOffset = new Vector3(0f, 1f, 0.5f) |
default is little up and in front of user of skill | |
string | projectileCreateAtTagged = "" |
Name of Tag to look for to identify mount/dummy object to create projectile at. | |
int | hitHeightPercentage = 50 |
0=at feet, 50=middle, 100=head/top | |
int | maxFlightDistance = 10 |
(meter) how far the projectile will move before it fizzle | |
float | maxLiveTime = 0 |
(seconds) how long it can live before fizzle | |
float | projectileMoveSpeed = 10f |
How fast projectile moves. | |
bool | triggerSecondaryOnFizzle = false |
Should the secondary effect trigger when the projectile fizzled? | |
bool | triggerSecondaryOnFizzleOnlyIfObstacle = true |
Should the secondary only trigger if the fizzle was cause by the projectile colliding with an obstacle? | |
float | collisionRayWidth = 0.0f |
Used by projectile to check when it hits something. 0 = ray cast is used, else a spherical cast is used. | |
bool | destroyProjectileOnHit = true |
Normally true for projectiles but can be set false if doing something special like beam weapon. | |
Protected Member Functions | |
void | Reset () |
void | Awake () |
void | Start () |
void | Update () |
void | LateUpdate () |
List< Targetable > | CollectTargets (Targetable selectedObject, int max, Vector3 aroundPoint, Vector3 direction, int angle, float radius) |
List< Targetable > | CollectSecondaryTargets (Targetable mainTarget, Vector3 aroundPoint) |
List< Targetable > | CollectTargetsBasedOnTargetingLocation (Targetable selectedObject, Vector3 selectedPosition, Vector3 mousePosition) |
virtual void | ExecuteInstant (Targetable selectedObject, Vector3 selectedPosition, Vector3 mousePosition) |
void | DoDelayedHit (DelayedHit dh) |
void | DoHitsOn (List< Targetable > targets) |
GameObject | ChooseProjectilePrefab () |
virtual void | CreateProjectile (int i, float waitTime, Vector3 projectileForward, Vector3 targetLocation, Transform targetTr, Vector3 followOffset) |
virtual void | ExecuteProjectile (Targetable selectedObject, Vector3 selectedPosition, Vector3 mousePosition) |
void | OnDrawGizmosSelected () |
Protected Attributes | |
EventHandler_Skills | eventHandler = null |
int | projectileFabCount = 0 |
float | executeTimer = 0.0f |
float | cooldownTimer = 0.0f |
List< DelayedHit > | delayedHits = new List<DelayedHit>(0) |
Properties | |
Actor | owner [get, set] |
The actor that owns this Skill. Skills area created as actual GameObjects placed inside the character that it belongs to at run-time. More... | |
PersistableObject | persistObj [get, set] |
A Skill, something an Actor can perform. This can be a lot of things and can range from attack skills like the swing of a sword or a fireball to the use of a pick to mind for some ore. The plyBlox system does most of the work when events related to the Skill is triggered.
How does a projectile move
In what direction or location the skill is executed
Enumerator | |
---|---|
ActorDirection |
Execution is in direction the character faces. |
MouseDirection |
Execution is, for Player - in direction from character to mouse, for NPC - from character to its selected target. |
SelectedDirection |
Execution is, in direction of selected target. |
AtClickPosition |
Need the player to click on a spot where the skill will collect targets in a specified radius. |
AtSelected |
Skill can only be used if a target is selected. |
MouseOver |
This works like typical ARPG where mouse click on valid enemy would cast spell on it (in this case hover with mouse over and press 1,2,3 would also allow the skill to execute) |
CameraForward |
Executed in exact forward direction of camera. |
CameraDirection |
In direction of camera on the XZ plane, ignoring camera's tilt (up/down) |
What are valid targets for the skill's effect
Enumerator | |
---|---|
Player |
Player can be targeted, regardless the status of the user's faction towards the player. |
FriendlyActor |
Any Actor that the user of Skill is Friendly towards. The status of Factions of the user towards the target Actor is used in the check. For NPCs towards the Player the NPC's status towards the player is also checked. |
NeutralActor |
Any Actor that the user of Skill is Neutral towards. See 'friendly' , above, for more info. |
HostileActor |
Any Actor that the user of Skill is Hostile towards. See 'friendly' , above, for more info. |
RPGObject |
An object can be targeted. |
bool plyGame.Skill.AttemptHit | ( | GameObject | onObject, |
Vector3 | hitPos | ||
) |
Called by Projectile to attempt hit on object. Return false if was invalid target.
bool plyGame.Skill.CoolingDown | ( | ) |
Return true if busy with cool-down
bool plyGame.Skill.DistanceAcceptable | ( | Vector3 | currPos, |
Vector3 | targetPos, | ||
Vector3 | mousePos, | ||
out Vector3 | wantedPos | ||
) |
Return true if the distance from target/ point is fine and skill can be executed. wantedPos is the target point that should be moved towards while continuously calling this function to check if in range yet.
|
virtual |
Tell Skill to execute now
void plyGame.Skill.ExecuteFizzleEvent | ( | Vector3 | pos, |
bool | wasObstacle | ||
) |
Ask Skill to call the Fizzle event in plyBlox
void plyGame.Skill.ExecuteSecondary | ( | Vector3 | atLocation, |
Targetable | ignore | ||
) |
Trigger the Skill's secondary effect at specified location. Can also specify a a targetable object to ignore when finding targets.
bool plyGame.Skill.FacingAcceptable | ( | Vector3 | currForward, |
Vector3 | targetPos, | ||
Vector3 | mousePos, | ||
out Vector3 | wantedDirection | ||
) |
Return true if the facing is within acceptable range. The returned wantedDirection can be used to turn character to correct facing if needed.
Targetable plyGame.Skill.FindValidTargetAt | ( | Ray | ray | ) |
Try and find first valid target that falls in the ray. Normally the ray comes from a mouse position to check if there is a valid target under the mouse cursor.
bool plyGame.Skill.IsExecuting | ( | ) |
Return true if the Skill is busy being executed. All skills are "instant" in creating their effects and only executionTime govern the Executing status.
bool plyGame.Skill.IsReady | ( | ) |
Return true if ready to execute and not on some cool down or being prevented in some other way.
bool plyGame.Skill.IsValidTargetable | ( | Targetable | target, |
Transform | checkTr, | ||
Vector3 | checkFrom, | ||
float | checkHeight, | ||
LayerMask | checkMask | ||
) |
First call IsValidTargetableType() and if that is fine it will check if there is an obstacle between the target and the checkTr position or checkFrom position of checkTr is null. The checkHeight is an offset from the checkTr or checkFrom positions and checkMask is the layers considered to be obstacles.
bool plyGame.Skill.IsValidTargetableType | ( | Targetable | target | ) |
Return true of the target is a valid targetable type for the skill, according to the skill's settings.