Unity RTS Engine

  1. Home
  2. Unity RTS Engine
  3. Attack Behavior
  4. Attack Component – General

Attack Component – General

General Settings of the attack component. Units and buildings will be referred to as faction entities.

  1. Is Locked: When enabled, the faction entity will not be able to use this attack type or switch to it.
  2. Is Active: When enabled, the faction entity will be able to engage enemy units and attack them.
  3. Code: A unique code for each attack component allows you to inspect the attack components in the custom attack-related delegate events that the RTS Engine offers.
  4. Icon: An icon that represents this attack (this is only used when the faction entity has more than one attack component attached to it and the icons will be used to draw the tasks with which the player can switch from one attack to another).
  5. Basic: Enable this field if this attack component is the default attack behavior of the faction entity.
  6. Attack Power: This value is used by AI components to assess which attacks are more fatal than others and this is taken into consideration while the NPC faction builds its army. So the higher this value is, the more important this attack is for the NPC faction.
  7. Attack Duration: When the attacker launches its attack, it will be blocked from moving (in case it’s a unit) during this time.
  8. Range (Units only): Defines the attacking unit’s stopping distance when engaging in an attack:
    1. Unit/Building Stopping Distance: When moving towards a target unit/building, this field is the minimum and maximum allowed stopping distance value for that movement.
    2. No Target Stopping Distance: The minimum and maximum allowed stopping distance value for an attack movement with no specific target (terrain attack).
    3. Include Target Radius: Include the target’s unit/building radius when determining the attack’s stopping distance?
    4. Move On Attack Offset: When the unit is allowed to move and attack at the same time, the value in this field will be added to the attack range of the unit.
    5. Update Mvt Distance: If the distance between the attack target and the attack target’s initial position when the target was locked gets higher than this value then the unit will adjust its position and move towards the target’s new position.
    6. Movement Formation: Each range type can have its own movement formation when moving towards an attack target. The movement formation defines how units will pick their target positions when calculating the movement path. For more information about movement formations, check out the Movement Manager component.
  9. Engage All Types: When enabled then the faction entity will be able to attack all enemy unit and building types. When disabled, the following options should appear:
    1. Engage Units: Enable if the faction entity can engage enemy units.
    2. Engage Buildings: Enable if the faction entity can engage enemy buildings.
    3. Engage In List & Codes List: Input faction entity codes or categories in the Codes List field (pick the type of the code first, either Entity Code or Entity Category) and either enable Engage In List so that the attacker can only attack the faction entities with the codes in the list or disable it to allow the attacker to attack all faction entity types expect the ones that have their codes in the list.
  10. Engage On Assign: Enable if the player can assign targets to the faction entity.
  11. Engage When Attacked: Enable if the faction entity can attack back its attacker when it doesn’t have an already active target.
  12. Engage Once: Enable if the faction entity can only launch an attack and then the target has to be re-assigned.
  13. Engage Friendly: Enable if the faction entity can attack friendly units/buildings.
  14. Move On Attack (Units only): Enable if the unit can launch its attack while moving (towards the target).
  15. Engage In Range: Enable if the faction entity can automatically search for a target and engage it.
  16. Search Range: If engaging in range is enabled, this defines the range in which the faction entity can search for a target. This value represents the attack range for buildings and for units that can not move.
  17. Search Reload: if engaging in range is enabled, this defines the time reload between each search for a target that the faction entity executes.
  18. Follow Distance (Units only): If the target escapes from the unit, then this value defines the maximum distance that the unit is allowed to follow the target for before it stops the attack.
  19. Require Target: When disabled, then the faction entity is able to launch an attack without having to be assigned a target. This is called a “Terrain Attack” and it can be toggled through the Attack Manager (this doc page also includes more information about this feature).
  20. Direct: Enable this option if the faction entity can apply damage directly to its target. Disable this if the faction entity launches an Attack Object towards the target which will only deal damage in case of collision with the target.
  21. Launch Type: In case the attack is not direct, there’s two possibilities to launch attack objects:
    1. Random: Randomly pick one attack object from the defined sources and launch it for each attack.
    2. In Order: Go through the entire sources list and launch attack objects in the order they have been added to the sources list.
  22. Attack Object Sources: This array defines the attack objects that the faction entity can launch during an attack, for each element assign:
    1. Attack Object: Drag and drop the attack object’s prefab into this field. This is the object that the faction entity will launch during the attack.
    2. Launch Position: The position of this transform is where the attack object will be launched from. Make sure that the transform assigned in this field is a child object of the faction entity’s main object.
    3. Accuracy Modifier: For each axis (x,y and z) assign a positive value if the attack object’s movement is subject to accuracy modification. The higher the value is for each axis, the less accurate the movement of the attack object will eventually be on that axis. This feature is currently available for single player only.
    4. Delay Time: Time in seconds before the attack object assigned to this element is created/launched.
    5. Create In Delay: When enabled and the Delay Time is set, then the attack object will be created when the delay time is going but it will not be moving until the delay time is over.
    6. Damage In Delay: If the attack object can be created in delay and this is enabled then the attack object will be able to apply damage when in delay.
    7. Delay Parent Object: If the attack object can be created in the delay time, this will its parent object during the delay time. Ignore this field if the attack object doesn’t have a parent in delay. As soon as the delay time is over, the attack object will be parent-free and will start moving towards its target.
  23. Delay Duration: Before the attack is launched, a delay time can be assigned in this field to delay the attack. This can be useful in case the unit’s attack animation starts before the actual attack, the delay time can be set to the time required for the animation to reach the attack launch stage.
  24. Delay Trigger Enabled: Enable this option if you’d like to delay the attack launch until it’s triggered using an external component which calls the “TriggerAttack()” method in the attack component.
  25. Attack Override Controller (Units only): Allows to have a different attack animation for the current attack type.
  26. Trigger Animation In Delay (Units only): Enable this if you’d like to trigger the unit’s attack animation while the delay time is running.
  27. Use Reload: Enable to have a reload time for this attack.
  28. Reload Time: In case attack reload is enabled, this field represents the reload time in seconds.
  29. Cool Down Enabled: When enabled, the faction entity’s attack will enter cool down mode after an attack is launched.
  30. Cool Down Duration: If cool down is enabled, this field is the time duration of the cool down in seconds.
  31. Reload Dealt Damage: The damage that the faction entity deals to its target can be retrieved using the public method “GetDealtDamage()” in the attack component. When this field is enabled, then the dealt damage counter will be reset every time a new target is assigned.
  32. Order Audio: Audio clip played when the faction entity is ordered to attack an enemy faction entity.
  33. Attack Audio: Audio clip played when the attack is launched.
  34. Task UI: Allows to display a dedicated task for the attacker in the task panel when it’s selected.
    1. Enabled: Only when this field is checked will the task be displayed.
    2. Icon: The task’s icon that will be displayed.
    3. Panel Category: In which task panel UI category will the task appear. For more information about UI task panel categories, check out the UI Manager.

How can we help?