Unity RTS Engine

  1. Home
  2. Unity RTS Engine
  3. Attack Behavior
  4. Attack Object

Attack Object

When attached to an object, the Attack Object and Effect Obj components allow the object to be launched through the attack component towards enemy faction entities.

A Collider component with “Is Trigger” enabled and a Rigidbody component with “Is Gravity” disabled and “Is Kinematic” enabled is also required to be attached to the attack object. This ensures that the attack object can detect collision with enemy faction entities and that its movement is not influenced by gravity.

  1. Speed: The movement speed of the attack object.
  2. Follow Target: Can the attack object follow its target if it’s moving?
  3. Follow Target Distance: Only if Follow Target is enabled, this defines the maximum distance the target object can move from its initial position (when the attack object is activated) before it stops following.
  4. Movement Type: Either linear or parabolic movement:
    1. Linear: No additional fields are required to be filled
    2. Parabolic: When it comes to a parabolic movement, assign the Maximum Height field to the height that the attack object will reach during the movement (it will reach the max height when it’s in the middle between the start and target positions). The Minimum Distance field is the minimum distance required to have between the attack object’s start position and its target position in order to have a parabolic movement, when the distance is less than the specified minimum, the movement will be just linear.
  5. Damage Once: Can the attack object damage multiple entities or only one?
  6. Destroy On Damage: Is the attack object destroyed (hidden) when it does damage?
  7. Child On Damage: When enabled, the attack object will become a child object of the object it damages.
  8. Obstacle Layer Mask: Define the layers of the objects that represent obstacles for the attack object. Entering in collision with an obstacle object will trigger the same behavior as colliding with a target, expect dealing damage.
  9. Trigger Effect: This effect object is an the effect that is shown when the attack object is activated/spawned.
  10. Trigger Effect Face Target: When enabled and there is a trigger effect, rotate it to face the target when created.
  11. Hit Effect: This effect object is spawned when the attack object deals damage to target or collides with an obstacle.
  12. Hit Audio: Audio clip played when the attack object deals damage to a target or collides with an obstacle.

The life time of the attack object can be specified in the Effect Object component attached to the attack object’s prefab.

How can we help?