Rename IState interface method names.
This commit is contained in:
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
|
|
||||||
public void Update(Squad squad)
|
public void Update(Squad squad)
|
||||||
{
|
{
|
||||||
currentState.Execute(squad);
|
currentState.Tick(squad);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeState(Squad squad, IState newState, bool rememberPrevious)
|
public void ChangeState(Squad squad, IState newState, bool rememberPrevious)
|
||||||
@@ -26,12 +26,12 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
previousState = currentState;
|
previousState = currentState;
|
||||||
|
|
||||||
if (currentState != null)
|
if (currentState != null)
|
||||||
currentState.Exit(squad);
|
currentState.Deactivate(squad);
|
||||||
|
|
||||||
if (newState != null)
|
if (newState != null)
|
||||||
currentState = newState;
|
currentState = newState;
|
||||||
|
|
||||||
currentState.Enter(squad);
|
currentState.Activate(squad);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RevertToPreviousState(Squad squad, bool saveCurrentState)
|
public void RevertToPreviousState(Squad squad, bool saveCurrentState)
|
||||||
@@ -42,8 +42,8 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
|
|
||||||
interface IState
|
interface IState
|
||||||
{
|
{
|
||||||
void Enter(Squad bot);
|
void Activate(Squad bot);
|
||||||
void Execute(Squad bot);
|
void Tick(Squad bot);
|
||||||
void Exit(Squad bot);
|
void Deactivate(Squad bot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,9 +147,9 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
|
|
||||||
class AirIdleState : AirStateBase, IState
|
class AirIdleState : AirStateBase, IState
|
||||||
{
|
{
|
||||||
public void Enter(Squad owner) { }
|
public void Activate(Squad owner) { }
|
||||||
|
|
||||||
public void Execute(Squad owner)
|
public void Tick(Squad owner)
|
||||||
{
|
{
|
||||||
if (owner.IsEmpty) return;
|
if (owner.IsEmpty) return;
|
||||||
|
|
||||||
@@ -169,14 +169,14 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Exit(Squad owner) { }
|
public void Deactivate(Squad owner) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
class AirAttackState : AirStateBase, IState
|
class AirAttackState : AirStateBase, IState
|
||||||
{
|
{
|
||||||
public void Enter(Squad owner) { }
|
public void Activate(Squad owner) { }
|
||||||
|
|
||||||
public void Execute(Squad owner)
|
public void Tick(Squad owner)
|
||||||
{
|
{
|
||||||
if (owner.IsEmpty) return;
|
if (owner.IsEmpty) return;
|
||||||
|
|
||||||
@@ -220,14 +220,14 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Exit(Squad owner) { }
|
public void Deactivate(Squad owner) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
class AirFleeState : AirStateBase, IState
|
class AirFleeState : AirStateBase, IState
|
||||||
{
|
{
|
||||||
public void Enter(Squad owner) { }
|
public void Activate(Squad owner) { }
|
||||||
|
|
||||||
public void Execute(Squad owner)
|
public void Tick(Squad owner)
|
||||||
{
|
{
|
||||||
if (owner.IsEmpty) return;
|
if (owner.IsEmpty) return;
|
||||||
|
|
||||||
@@ -246,6 +246,6 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
owner.fsm.ChangeState(owner, new AirIdleState(), true);
|
owner.fsm.ChangeState(owner, new AirIdleState(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Exit(Squad owner) { }
|
public void Deactivate(Squad owner) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
|
|
||||||
class GroundUnitsIdleState : GroundStateBase, IState
|
class GroundUnitsIdleState : GroundStateBase, IState
|
||||||
{
|
{
|
||||||
public void Enter(Squad owner) { }
|
public void Activate(Squad owner) { }
|
||||||
|
|
||||||
public void Execute(Squad owner)
|
public void Tick(Squad owner)
|
||||||
{
|
{
|
||||||
if (owner.IsEmpty) return;
|
if (owner.IsEmpty) return;
|
||||||
if (!owner.TargetIsValid)
|
if (!owner.TargetIsValid)
|
||||||
@@ -62,14 +62,14 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Exit(Squad owner) { }
|
public void Deactivate(Squad owner) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroundUnitsAttackMoveState : GroundStateBase, IState
|
class GroundUnitsAttackMoveState : GroundStateBase, IState
|
||||||
{
|
{
|
||||||
public void Enter(Squad owner) { }
|
public void Activate(Squad owner) { }
|
||||||
|
|
||||||
public void Execute(Squad owner)
|
public void Tick(Squad owner)
|
||||||
{
|
{
|
||||||
if (owner.IsEmpty) return;
|
if (owner.IsEmpty) return;
|
||||||
|
|
||||||
@@ -119,14 +119,14 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Exit(Squad owner) { }
|
public void Deactivate(Squad owner) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroundUnitsAttackState : GroundStateBase, IState
|
class GroundUnitsAttackState : GroundStateBase, IState
|
||||||
{
|
{
|
||||||
public void Enter(Squad owner) { }
|
public void Activate(Squad owner) { }
|
||||||
|
|
||||||
public void Execute(Squad owner)
|
public void Tick(Squad owner)
|
||||||
{
|
{
|
||||||
if (owner.IsEmpty) return;
|
if (owner.IsEmpty) return;
|
||||||
|
|
||||||
@@ -152,14 +152,14 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Exit(Squad owner) { }
|
public void Deactivate(Squad owner) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroundUnitsFleeState : GroundStateBase, IState
|
class GroundUnitsFleeState : GroundStateBase, IState
|
||||||
{
|
{
|
||||||
public void Enter(Squad owner) { }
|
public void Activate(Squad owner) { }
|
||||||
|
|
||||||
public void Execute(Squad owner)
|
public void Tick(Squad owner)
|
||||||
{
|
{
|
||||||
if (owner.IsEmpty) return;
|
if (owner.IsEmpty) return;
|
||||||
|
|
||||||
@@ -167,6 +167,6 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
owner.fsm.ChangeState(owner, new GroundUnitsIdleState(), true);
|
owner.fsm.ChangeState(owner, new GroundUnitsIdleState(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Exit(Squad owner) { owner.units.Clear(); }
|
public void Deactivate(Squad owner) { owner.units.Clear(); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,16 +16,16 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
{
|
{
|
||||||
class UnitsForProtectionIdleState : GroundStateBase, IState
|
class UnitsForProtectionIdleState : GroundStateBase, IState
|
||||||
{
|
{
|
||||||
public void Enter(Squad owner) { }
|
public void Activate(Squad owner) { }
|
||||||
public void Execute(Squad owner) { owner.fsm.ChangeState(owner, new UnitsForProtectionAttackState(), true); }
|
public void Tick(Squad owner) { owner.fsm.ChangeState(owner, new UnitsForProtectionAttackState(), true); }
|
||||||
public void Exit(Squad owner) { }
|
public void Deactivate(Squad owner) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
class UnitsForProtectionAttackState : GroundStateBase, IState
|
class UnitsForProtectionAttackState : GroundStateBase, IState
|
||||||
{
|
{
|
||||||
public void Enter(Squad owner) { }
|
public void Activate(Squad owner) { }
|
||||||
|
|
||||||
public void Execute(Squad owner)
|
public void Tick(Squad owner)
|
||||||
{
|
{
|
||||||
if (owner.IsEmpty) return;
|
if (owner.IsEmpty) return;
|
||||||
if (!owner.TargetIsValid)
|
if (!owner.TargetIsValid)
|
||||||
@@ -44,14 +44,14 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
owner.world.IssueOrder(new Order("AttackMove", a, false) { TargetLocation = owner.Target.Location });
|
owner.world.IssueOrder(new Order("AttackMove", a, false) { TargetLocation = owner.Target.Location });
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Exit(Squad owner) { }
|
public void Deactivate(Squad owner) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
class UnitsForProtectionFleeState : GroundStateBase, IState
|
class UnitsForProtectionFleeState : GroundStateBase, IState
|
||||||
{
|
{
|
||||||
public void Enter(Squad owner) { }
|
public void Activate(Squad owner) { }
|
||||||
|
|
||||||
public void Execute(Squad owner)
|
public void Tick(Squad owner)
|
||||||
{
|
{
|
||||||
if (owner.IsEmpty) return;
|
if (owner.IsEmpty) return;
|
||||||
|
|
||||||
@@ -59,6 +59,6 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
owner.fsm.ChangeState(owner, new UnitsForProtectionIdleState(), true);
|
owner.fsm.ChangeState(owner, new UnitsForProtectionIdleState(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Exit(Squad owner) { owner.units.Clear(); }
|
public void Deactivate(Squad owner) { owner.units.Clear(); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user