java.lang.Object
net.botwithus.rs3.game.scene.entities.Entity
net.botwithus.rs3.game.scene.entities.animation.Projectile
- All Implemented Interfaces:
Identifiable
,Validatable
,Locatable
-
Nested Class Summary
Nested classes/interfaces inherited from class net.botwithus.rs3.game.scene.entities.Entity
Entity.Type
-
Field Summary
-
Constructor Summary
ConstructorDescriptionProjectile
(int id, Coordinate coordinate, int sourceIndex, int sourceType, int targetIndex, int targetType, long startCycle, long endCycle, Coordinate start, Coordinate end, ScenePosition scene) -
Method Summary
Modifier and TypeMethodDescriptionReturns the end position of the projectile.long
Returns the end cycle of theProjectile
.Gets the source of this projectile animation.double
getSpeed()
Calculates the speed of the animation.getStart()
Returns the start position of the projectile.long
Returns the start cycle of theProjectile
.Gets the target of this projectile animation or null if it cannot be determined.boolean
hasReachedTarget
(long currentCycle) Checks if the current cycle has reached the target cycle.boolean
isInFlight
(long cycle) Checks if the projectile is in flight at the specified cycle.boolean
validate()
Gets whether the object is valid There can be many reasons aValidatable
may not be valid.Methods inherited from class net.botwithus.rs3.game.scene.entities.Entity
equals, getArea, getCoordinate, getId, getScene, getType, hashCode
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.botwithus.rs3.game.Locatable
distanceTo, isReachable
-
Constructor Details
-
Projectile
public Projectile(int id, Coordinate coordinate, int sourceIndex, int sourceType, int targetIndex, int targetType, long startCycle, long endCycle, Coordinate start, Coordinate end, ScenePosition scene)
-
-
Method Details
-
getSource
Gets the source of this projectile animation.- Returns:
- the source of this projectile animation or null if it cannot be determined.
-
getTarget
Gets the target of this projectile animation or null if it cannot be determined.- Returns:
- The target of this projectile animation or null if it cannot be determined.
-
getStartCycle
public long getStartCycle()Returns the start cycle of theProjectile
.- Returns:
- The start cycle of the
Projectile
.
-
getEndCycle
public long getEndCycle()Returns the end cycle of theProjectile
.- Returns:
- The end cycle of the
Projectile
.
-
getStart
Returns the start position of the projectile.- Returns:
- The start position of the projectile.
-
getDestination
Returns the end position of the projectile.- Returns:
- the end position of the projectile
-
getSpeed
public double getSpeed()Calculates the speed of the animation.- Returns:
- the speed of the animation
-
hasReachedTarget
public boolean hasReachedTarget(long currentCycle) Checks if the current cycle has reached the target cycle.- Parameters:
currentCycle
- The current cycle.- Returns:
- True if the current cycle has reached the target cycle, false otherwise.
-
isInFlight
public boolean isInFlight(long cycle) Checks if the projectile is in flight at the specified cycle.- Parameters:
cycle
- The current cycle.- Returns:
- True if the projectile is in flight, false otherwise.
-
validate
public boolean validate()Description copied from interface:Validatable
Gets whether the object is valid There can be many reasons aValidatable
may not be valid. These can range from the entity has despawned, a component has closed, a coordinate is no longer in the scene, an animation sequence has ended, and many other reasons..- Returns:
-