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
This commit is contained in:
parent
8d4bd04891
commit
b53e4aec8c
204 changed files with 8182 additions and 1919 deletions
31
Assets/Scripts/ServerShared/Agents/Tasks/PatrolOrbits.cs
Normal file
31
Assets/Scripts/ServerShared/Agents/Tasks/PatrolOrbits.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
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));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue