init
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
using VOID.Generic.Objects.Abstract;
|
||||
using VOID.Generic.Objects.Unit.Actions.Exceptions;
|
||||
using VOID.Generic.Objects.Unit.Events;
|
||||
using VOID.Generic.Util;
|
||||
|
||||
namespace VOID.Generic.Objects.Unit.Actions
|
||||
{
|
||||
public class InspectAction : AbstractAction
|
||||
{
|
||||
private readonly UnitObject _unit;
|
||||
private readonly AbstractObject _targetObject;
|
||||
private bool _isInspectFinished;
|
||||
|
||||
public InspectAction(UnitObject unit, AbstractObject targetObject)
|
||||
{
|
||||
_unit = unit;
|
||||
_targetObject = targetObject;
|
||||
}
|
||||
|
||||
public override bool IsInRange()
|
||||
{
|
||||
return RangeUtil.IsInRange(_unit, _targetObject, _unit.unitData.inspectRange);
|
||||
}
|
||||
|
||||
protected override void OnEndIt() { }
|
||||
|
||||
protected override void OnCancelIt() { }
|
||||
|
||||
public override void CanDoIt()
|
||||
{
|
||||
Check(
|
||||
_targetObject.basicData.canBeInspected,
|
||||
UnitActionErrorType.OtherUnitCantBeInspected);
|
||||
Check(
|
||||
_unit.unitData.canInspect,
|
||||
UnitActionErrorType.ThisUnitCantInspect);
|
||||
Check(
|
||||
state == ActionState.Ready,
|
||||
UnitActionErrorType.ActionStateIsNotReady);
|
||||
if (_unit.basicState.turnManager)
|
||||
{
|
||||
Check(
|
||||
_unit.unitState.isSelfTurn,
|
||||
UnitActionErrorType.UnitSelfTurnNotActive);
|
||||
}
|
||||
Check(
|
||||
_unit.unitState.isControllable,
|
||||
UnitActionErrorType.UnitStateIsNotControllable);
|
||||
Check(
|
||||
IsInRange(),
|
||||
UnitActionErrorType.NotInRange);
|
||||
}
|
||||
|
||||
protected override void OnDoIt()
|
||||
{
|
||||
new RotateAction(_unit, _targetObject).DoIt();
|
||||
BeforePerform();
|
||||
// Tutaj inspekcja
|
||||
AfterPerform();
|
||||
EndIt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user