Aetheria/Assets/Scripts/ServerShared/Agents/Minion.cs
Reinier Vens b53e4aec8c Combat & Visibility & Collisions
Converted entity materials to new fade shader
Implemented visibility system
Refactored per-instance entity code to run inside monobehavior on entity instances
Created state machine AI for enemy ships with basic patrol and combat routines
Removed legacy AI code (controller item behaviors)
Added automatic trigger group assignment for matched weapons
Created ship collision system
Created shield VFX and colliders
2021-02-26 19:01:47 +00:00

23 lines
No EOL
752 B
C#

using System.Linq;
using UniRx;
public class Minion : Agent
{
public Minion(Ship ship) : base(ship)
{
var patrolState = new PatrolOrbitsState(this);
_rootState.AddTransition(patrolState,
() => Task is PatrolOrbitsTask,
() => patrolState.Task = Task as PatrolOrbitsTask);
Ship.VisibleHostiles.ObserveAdd().Where(_ => Ship.Target.Value == null).Subscribe(add => Ship.Target.Value = add.Value);
var combatState = new CombatState(this);
_rootState.AddTransition(combatState,
() => Ship.Target.Value != null, null, true, _rootState);
combatState.AddTransition(_rootState,
() => Ship.Target.Value == null, null, true, _rootState);
}
}