예제 #1
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public BottomTrackOnViewModel()
            : base("Bottom Track On")
        {
            // Initialize values
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            ConfigKey = "";

            // Create the list
            CreateList();

            // Next command
            NextCommand = ReactiveCommand.Create();
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.BinsView, ConfigKey)));

            // Back coommand
            BackCommand = ReactiveCommand.Create();
            BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back)));

            // Exit coommand
            ExitCommand = ReactiveCommand.Create();
            ExitCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView)));

            MovingCommand = ReactiveCommand.Create();
            MovingCommand.Subscribe(_ => MovingBoat());

            MovingCommand = ReactiveCommand.Create();
            MovingCommand.Subscribe(_ => MonitoringAdcp());
        }
예제 #2
0
        public void executeCommand(MovingCommand command)
        {
            switch (command)
            {
            case MovingCommand.R:    //spin 90 dgrees right
                this.currentLocation.heading = (this.currentLocation.heading == Heading.W) ? Heading.N : this.currentLocation.heading + 1;
                break;

            case MovingCommand.L:    //spin 90 dgrees left
                this.currentLocation.heading = (this.currentLocation.heading == Heading.N) ? Heading.W : this.currentLocation.heading - 1;
                break;

            case MovingCommand.M:    //move one grid point forward
                switch (this.currentLocation.heading)
                {
                case Heading.N:
                    this.currentLocation.y++;
                    break;

                case Heading.E:
                    this.currentLocation.x++;
                    break;

                case Heading.S:
                    this.currentLocation.y--;
                    break;

                case Heading.W:
                    this.currentLocation.x--;
                    break;
                }

                break;
            }
        }
예제 #3
0
 public Animation(ICreature creature, MovingCommand command, Point location, int frame, CellType type)
 {
     this.CellType   = type;
     Creature        = creature;
     Command         = command;
     LocationOnField = location;
     TargetLocation  = new Point(location.X + command.DeltaX, location.Y + command.DeltaY);
     Frame           = frame;
     //SetSprite();
     //LocationOnControl = new Point(location.X * Sprite.SpriteSize.Width + Sprite.SpriteSize.Width,
     //    location.Y * Sprite.SpriteSize.Height - Sprite.SpriteSize.Height);
     //LocationOnControl = new Point(location.X * 32, location.Y * 32 - Sprite.SpriteSize.Height/2);
 }
예제 #4
0
    void Start()
    {
        //Bind keys with commands
        buttonW = new MovingCommand(playerBlue.PlayerObject, playerBlue.Speed, MovingDirction.Up);
        buttonS = new MovingCommand(playerBlue.PlayerObject, playerBlue.Speed, MovingDirction.Down);
        buttonA = new MovingCommand(playerBlue.PlayerObject, playerBlue.Speed, MovingDirction.Left);
        buttonD = new MovingCommand(playerBlue.PlayerObject, playerBlue.Speed, MovingDirction.Right);
        buttonQ = new PickupCommand(playerBlue.PlayerObject);

        buttonI = new MovingCommand(playerRed.PlayerObject, playerRed.Speed, MovingDirction.Up);
        buttonK = new MovingCommand(playerRed.PlayerObject, playerRed.Speed, MovingDirction.Down);
        buttonJ = new MovingCommand(playerRed.PlayerObject, playerRed.Speed, MovingDirction.Left);
        buttonL = new MovingCommand(playerRed.PlayerObject, playerRed.Speed, MovingDirction.Right);
        buttonU = new PickupCommand(playerRed.PlayerObject);
    }
    // Update is called once per frame
    void Update()
    {
        foreach (var item in keyMap.OnReleasedKeyMap)
        {
            if (Input.GetKeyUp(item.Key))
            {
                Debug.Log(string.Format("onReleasedKeyMap Key Released {0}", item.Value.ToString()));
                //Command command = null;
            }
        }

        foreach (var item in keyMap.OnKeyDownMap)
        {
            if (Input.GetKey(item.Key))
            {
                Command command = null;
                switch (item.Value)
                {
                case "OnlyAim":
                    command = new OnlyAimCommand();
                    break;
                }
                if (command != null)
                {
                    if (command is ICommand)
                    {
                        Commands.Push((ICommand)command);
                    }
                    command.Execute(MoveCommandTarget);
                }
            }

            if (Input.GetKeyDown(item.Key))
            {
                Command command = null;
                switch (item.Value)
                {
                case "Moving":
                    command = new MovingCommand();
                    break;

                case "CastArcaneBolt":
                    command = new ArcaneBoltCommand();
                    break;

                case "CastFireBolt":
                    command = new FireBoltCommand();
                    break;

                case "CastIceBolt":
                    command = new IceBoltCommand();
                    break;

                case "RestartGame":
                    command = new RestartGameCommand();
                    break;

                case "ExitGame":
                    command = new ExitGameCommand();
                    break;
                }
                if (command != null)
                {
                    if (command is ICommand)
                    {
                        Commands.Push((ICommand)command);
                    }
                    command.Execute(MoveCommandTarget);
                }
            }
        }
    }