Implemented hostility system - entities can mark each other as friend or foe depending on changing conditions (currently only depends on local security level) Added "friendly" target indicators in blue
23 lines
No EOL
749 B
C#
23 lines
No EOL
749 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.VisibleEnemies.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);
|
|
}
|
|
} |