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
31 lines
No EOL
867 B
C#
31 lines
No EOL
867 B
C#
using System;
|
|
|
|
public class PatrolOrbitsTask : AgentTask
|
|
{
|
|
public override TaskType Type => TaskType.Defend;
|
|
public Guid[] Circuit;
|
|
}
|
|
|
|
public class PatrolOrbitsState : BaseState
|
|
{
|
|
public PatrolOrbitsTask Task;
|
|
public Guid CurrentTarget
|
|
{
|
|
get => Task.Circuit[_currentTargetIndex];
|
|
}
|
|
private int _currentTargetIndex;
|
|
public void NextTarget()
|
|
{
|
|
_currentTargetIndex++;
|
|
_currentTargetIndex %= Task.Circuit.Length;
|
|
}
|
|
|
|
public PatrolOrbitsState(Agent agent) : base(agent)
|
|
{
|
|
var patrolMoveState = new MoveToOrbitState(agent);
|
|
Transitions.Add(new StateTransition(patrolMoveState,
|
|
() => true,
|
|
() => patrolMoveState.Orbit = CurrentTarget));
|
|
patrolMoveState.Transitions.Add(new StateTransition(this, () => patrolMoveState.Distance < 10, NextTarget));
|
|
}
|
|
} |