42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using System;
|
|
using VOID.Generic.Objects.Unit.Actions;
|
|
using VOID.Generic.Player.Input;
|
|
using VOID.Generic.Player.Util;
|
|
using VOID.UserInterface.Game;
|
|
|
|
namespace VOID.Generic.Player.CursorOperation
|
|
{
|
|
public class OnSceneCursorOperation : AbstractCursorOperation
|
|
{
|
|
public override Type ForType() => null;
|
|
|
|
public override bool Check(SelectUtilResult select)
|
|
{
|
|
return !select.onUI && !select.selectObject;
|
|
}
|
|
|
|
public override void DoDefault(SelectUtilResult select, bool isAlternate)
|
|
{
|
|
if (isAlternate) return;
|
|
|
|
var activeUnit = PlayerController.current.activeUnit;
|
|
var attackAbility = activeUnit.unitAbilityBook.attackAbility;
|
|
|
|
if (activeUnit.unitData.canAttack && PlayerInputManager.current.isForceAttack)
|
|
{
|
|
activeUnit.Order(new MoveAction(activeUnit, select.position, attackAbility.range));
|
|
activeUnit.Order(new AbilityAction(activeUnit, attackAbility, select.position));
|
|
return;
|
|
}
|
|
|
|
activeUnit.OrderStop();
|
|
activeUnit.Order(new MoveAction(activeUnit, select.position));
|
|
}
|
|
|
|
public override void DoContext(SelectUtilResult select)
|
|
{
|
|
ContextMenuUI.current.Close();
|
|
PlayerController.current.activeUnit.OrderStop();
|
|
}
|
|
}
|
|
} |