Example #1
0
        public UnitResponse ProcessCommand(object _command)
        {
            var command = Compatibility.Check <IDWMCommand>(this, _command);

            if (command.DifWheelMovement == null)
            {
                return(UnitResponse.Denied());
            }
            this.movement = command.DifWheelMovement;
            return(UnitResponse.Accepted(command.DifWheelMovement.Duration));
        }
Example #2
0
        public UnitResponse ProcessCommand(object _command)
        {
            var command = Compatibility.Check <ISimpleMovementCommand>(this, _command);

            Debugger.Log("Command accepted in SMUnit");
            var c = command.SimpleMovement;

            if (c == null)
            {
                currentMovement = null;
                return(UnitResponse.Denied());
            }
            currentMovement = c;
            ApplyCommand(actor.World.Clocks.CurrentTime);
            return(UnitResponse.Accepted(command.SimpleMovement.Duration));
        }
Example #3
0
        public override UnitResponse ProcessCommand(object _cmd)
        {
            var cmd = Compatibility.Check <IGripperCommand>(this, _cmd);

            Debugger.Log("Command comes to gripper, " + cmd.GripperCommand.ToString());
            switch (cmd.GripperCommand)
            {
            case GripperAction.No: return(UnitResponse.Denied());

            case GripperAction.Grip:
                Grip();
                return(UnitResponse.Accepted(rules.GrippingTime));

            case GripperAction.Release:
                Release();
                return(UnitResponse.Accepted(rules.ReleasingTime));
            }
            throw new Exception("Cannot reach this part of code");
        }