Combat

Overview

Define the unit spawn parameters of opposing Blue and Red agents. Autonomous behaviors enable each side to navigate obstacles and engage via line-of-sight in order to reach a waypoint.

Page Contents

Purpose

Define the unit spawn parameters of opposing Blue and Red agents. Autonomous behaviors enable each side to navigate obstacles and engage via line-of-sight in order to reach a waypoint.

How to Use

During run-time, autonomous agents navigate around obstacles and engage the opposing side in order to reach a waypoint. It may be possible to add player input in conjunction with the ExampleAgentCommands script and SelectorUI prefab.

Scene Location & Name

Assets/Ride/Examples/ExampleCombat/ExampleCombat.unity

Setup Requirements 

Utilize the combat API for your scene by adding the ExampleCombat script and Waypoint_AutoAddToRide prefab. 

Waypoint_AutoAddToRide Prefab

First, import the Waypoint_AutoAddToRide prefab into your scene.

Note, the ExampleCombat scene places two instances of this object under Floor > SpawnAreas, renaming to “Marineside” and “InsurgentSide”. Recommend giving each a unique name in your scene. 

Under the Waypoint Mono script component, ensure Attribute set to “waypoint” and Flags set to “Blue_Spawner” in one object and “Red_Spawner” in the other if re-creating ExampleCombat scene. 

ExampleCombat Script

Next, add this script to an object in your scene to control the spawn behavior of units. The parameters are as follows:

  • Spawn Time (Seconds between waves)
  • Spawn Amount (Number of units in each wave)
  • Max Waves (Number of waves to spawn in total before stopping)

Last, ensure Blue Spawner and Red Spawner selections match their respective waypoint objects in the scene.