Пример #1
0
        internal override void ExecuteOrder()
        {
            List <string> result = new List <string>();

            result.Add(string.Format("Attempting to execute order: {0}", this.ToString()));

            if (TargetPosition == CurrentShip.Position) // already at target location
            {
                result.Add("Already at target location!");
                OnMessageResult?.Invoke(this, new MessageEventArgs(result));
            }
            else if (CurrentShip.MP.Current < 1) // no remaining MP
            {
                result.Add("No remaining MP!! [[BAD CODE!! BAD!! NO BISCUT!!]]");
                OnMessageResult?.Invoke(this, new MessageEventArgs(result));
            }
            else if (!CurrentShip.Position.IsAdjacent(TargetPosition)) // invalid movement location
            {
                result.Add("Target Position is not an adjacent location!! [[BAD CODE!! BAD!! GO TO YOUR ROOM!!]]");
                OnMessageResult?.Invoke(this, new MessageEventArgs(result));
            }
            else if (Simulation.Features.Any(x => x.Position == TargetPosition && x.IsBlocking) ||
                     Simulation.Ships.Any(x => x.Position == TargetPosition && x.ID != CurrentShip.ID)) // trying to move into blocking feature or ship
            {
                result.Add("ABORT ORDER, IMMINENT COLLISION!! [[BAD CODE!! BAD!! DO THAT OUTSIDE!!]]");
                OnMessageResult?.Invoke(this, new MessageEventArgs(result));
            }
            else
            {
                CurrentShip.Position = TargetPosition;
                result.Add(string.Format("Moved to {0}", TargetPosition.ToString()));
                OnShipMoved?.Invoke(this, new ShipMovedEventArgs(CurrentShip.ID, TargetPosition, result));
            }
        }
        void ActionCommand_Executed(object obj)
        {
            if (!ConnectState)
            {
                MessageBox.Show("连接未开启,请开启服务后再进行操作!");
                return;
            }

            //发送起始位置
            S7.WriteValue("DBAddress", "Int", StartPosition.ToString(), 0);
            //发送目标位置
            S7.WriteValue("DBAddress", "Int", TargetPosition.ToString(), 0);
            //发送动作类型  1:移动 2:搬运
            S7.WriteValue("DBAddress", "Int", ActionType, 0);
        }
Пример #3
0
 public override string ToString()
 {
     return(string.Format("Move {0} to {1}", CurrentShip.ToString(), TargetPosition.ToString()));
 }
Пример #4
0
 public new void Debug()
 {
     Player.print("Buster " + EntityId + " / state : " + State + " / position : " + Position.ToString() + " / target : " + TargetPosition.ToString() + " / can capture : " + CanCapture().ToString() + " / is holding : " + IsHoldingAGhost().ToString() + " / can release : " + CanRelease().ToString() + " / can attack : " + CanAttack().ToString() + " / can stun : " + CanStun + " / last turn stun : " + LastTurnStun.ToString() + " / ghost chased : " + ((GhostChased != null) ? GhostChased.EntityId : -1) + " / ghost in range : " + ((GhostInRange != null) ? GhostInRange.EntityId : -1) + " / enemy chased : " + ((EnemyChased != null) ? EnemyChased.EntityId : -1) + " / enemy in range : " + ((EnemyInRange != null) ? EnemyInRange.EntityId : -1) + " / stunned : " + IsStunned + " / busy : " + IsBusy());
 }
Пример #5
0
 public override string ToString()
 {
     return(GetType().Name + " " + Performer + " -> " +
            (TargetEntity != null ? TargetEntity.ToString() : TargetPosition.ToString()) + " (" +
            Math.Ceiling(duractionAcc) + "s left)");
 }