Inheritance: MonoBehaviour
Ejemplo n.º 1
0
    // Update is called once per frame
    void FixedUpdate()
    {
        rb.AddForce(0, 0, forwardForce * Time.deltaTime);

        if (Input.GetKey("d"))
        {
            Command commandRight = new MoveRight(m_PlayerReceiver, rb, text);
            Invoker invoker      = new Invoker();
            invoker.SetCommand(commandRight);
            invoker.ExecuteCommand();
        }

        if (Input.GetKey("a"))
        {
            Command commandLeft = new MoveLeft(m_PlayerReceiver, rb, text);
            Invoker invoker     = new Invoker();
            invoker.SetCommand(commandLeft);
            invoker.ExecuteCommand();
        }

        if (rb.position.y < -1f)
        {
            FindObjectOfType <GameManager>().EndGame();
        }
    }
Ejemplo n.º 2
0
    Command GetCommand(Action Action)
    {
        Command cmd = null;

        switch (Action)
        {
        case Action.LEFT:
            cmd = new MoveLeft(m_rebel);
            break;

        case Action.RIGHT:
            cmd = new MoveRight(m_rebel);
            break;

        case Action.JUMP:
            cmd = new Jump(m_rebel);
            break;

        case Action.DUCK:
            cmd = new Duck(m_rebel);
            break;

        case Action.COLOR:
            cmd = new ChangeColor(m_rebel);
            break;
        }

        return(cmd);
    }
Ejemplo n.º 3
0
 // Start is called before the first frame update
 void Start()
 {
     KeyW = new MoveUp();
     KeyS = new MoveDown();
     KeyA = new MoveLeft();
     KeyD = new MoveRight();
 }
Ejemplo n.º 4
0
        public void Move(KeyboardState keyboardState, KeyboardState previousState)
        {
            ICommand cmd = null;

            if (keyboardState.IsKeyDown(Keys.W) && !previousState.IsKeyDown(Keys.W))
            {
                cmd = new MoveForward(this);
            }
            if (keyboardState.IsKeyDown(Keys.S) && !previousState.IsKeyDown(Keys.S))
            {
                cmd = new MoveBackward(this);
            }
            if (keyboardState.IsKeyDown(Keys.A) && !previousState.IsKeyDown(Keys.A))
            {
                cmd = new MoveLeft(this);
            }
            if (keyboardState.IsKeyDown(Keys.D) && !previousState.IsKeyDown(Keys.D))
            {
                cmd = new MoveRight(this);
            }

            if (cmd != null)
            {
                MoveMemory.SaveState(SaveMemento());
                cmd.Execute();
                Notify();
            }
        }
    // Update is called once per frame
    void FixedUpdate()
    {
        rb.AddForce(0, 0, forwardForce * Time.deltaTime);

        if (Input.GetKey("d")) // MOVE RIGHT
        {
            ////////////////////////////////////////////////////////////////////////////
            // --- IMPLEMENTING THE COMMAND PATTERN - START HERE ---
            // instead of just calling addforce, we want to package this up as a command
            // and send to an invoker
            // we'll need a command class, some commands, and an invoker...
            //rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
            Command moveRight = new MoveRight(rb, sidewaysForce);
            Invoker invoker   = new Invoker();
            invoker.SetCommand(moveRight);
            invoker.ExecuteCommand();
        }
        if (Input.GetKey("a")) // MOVE LEFT
        {
            //rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
            Command moveLeft = new MoveLeft(rb, sidewaysForce);
            Invoker invoker  = new Invoker();
            invoker.SetCommand(moveLeft);
            invoker.ExecuteCommand();
        }

        if (rb.position.y < -1f)
        {
            FindObjectOfType <GameManager>().EndGame();
        }
    }
Ejemplo n.º 6
0
        private void Update()
        {
            var keyboard = Keyboard.current;

            if (keyboard == null)
            {
                return;
            }

            if (Enabled)
            {
                if (keyboard.spaceKey.wasPressedThisFrame)
                {
                    JumpForward?.Invoke();
                }

                if (keyboard.aKey.wasPressedThisFrame)
                {
                    MoveLeft?.Invoke();
                }

                if (keyboard.dKey.wasPressedThisFrame)
                {
                    MoveRight?.Invoke();
                }
            }
        }
Ejemplo n.º 7
0
    // Update is called once per frame
    void FixedUpdate()
    {
        rb.AddForce(0, 0, forwardForce * Time.deltaTime);

        if (Input.GetKey("d"))   // MOVE RIGHT
        {
            Command moveRight = new MoveRight(rb, sidewaysForce);
            Invoker invoker   = new Invoker();
            invoker.SetCommand(moveRight);
            invoker.ExecuteCommand();
        }
        if (Input.GetKey("a")) // MOVE LEFT
        {
            //rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
            Command moveLeft = new MoveLeft(rb, sidewaysForce);
            Invoker invoker  = new Invoker();
            invoker.SetCommand(moveLeft);
            invoker.ExecuteCommand();
        }

        if (rb.position.y < -1f)
        {
            FindObjectOfType <GameManager>().EndGame();
        }
    }
    void FixedUpdate()
    {
        rb.AddForce(0, 0, forwardForce * Time.deltaTime);

        if (Input.GetKey("d"))
        {
            Command moveRight = new MoveRight(rb, sideForce);
            Invoker invoker   = new Invoker();
            invoker.SetCommand(moveRight);
            commandsUI.text += "\n" + moveRight.ToString();
            invoker.ExecuteCommand();
        }

        if (Input.GetKey("a"))
        {
            Command moveLeft = new MoveLeft(rb, sideForce);
            Invoker invoker  = new Invoker();
            invoker.SetCommand(moveLeft);
            commandsUI.text += "\n" + moveLeft.ToString();
            invoker.ExecuteCommand();
        }

        if (rb.position.y < -1f)
        {
            FindObjectOfType <GameManager>().EndGame(null);
        }

        if (rb.GetComponentInParent <Transform>().position.z > milestoneScore)
        {
            OnMilestone?.Invoke();
        }
    }
Ejemplo n.º 9
0
    //public Text commandLog;

    // We marked this a s"Fixed"Update because we
    // are using it to mess with physics
    void FixedUpdate()
    {
        // Add a forward force
        rb.AddForce(0, 0, forwardForce * Time.deltaTime);

        if (Input.GetKey("d"))
        {
            // Only executed if condition is met
            //rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
            Command moveR  = new MoveRight(rb, sidewaysForce);
            Invoker invoke = new Invoker();
            invoke.SetCommand(moveR);

            //commandLog.text += moveR.ToString() + "\n";
            invoke.ExeCommand();
        }

        if (Input.GetKey("a"))
        {
            // Only executed if condition is met
            //rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
            Command moveL  = new MoveLeft(rb, sidewaysForce);
            Invoker invoke = new Invoker();
            invoke.SetCommand(moveL);
            invoke.ExeCommand();
            //commandLog.text += moveL.ToString() + "\n";
        }

        if (rb.position.x < -8f || rb.position.x > 8f)
        {
            FindObjectOfType <gameManager>().endGame(null);
        }
    }
Ejemplo n.º 10
0
 private void Form1_KeyUp(object sender, KeyEventArgs e)
 {//Stops movement when key is lifted
     MoveUp.Stop();
     MoveDown.Stop();
     MoveRight.Stop();
     MoveLeft.Stop();
 }
Ejemplo n.º 11
0
    // We marked this as "Fixed"Update because we
    // are using it to mess with physics
    void FixedUpdate()
    {
        // Add a forward force
        rb.AddForce(0, 0, forwardForce * Time.deltaTime);

        if (Input.GetKey("d") || Input.GetKey(KeyCode.RightArrow))     // If the player is perssing the "d" key
        {
            // Add a force to the right
            // Add a force to the right
            //rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
            Command moveRight = new MoveRight(rb, sidewaysForce);
            Invoker invoker = new Invoker();
            invoker.SetCommand(moveRight);
            invoker.ExecuteCommand();
        }

        if (Input.GetKey("a") || Input.GetKey(KeyCode.LeftArrow))      // If the player is pressing the "a" key
        {
            // Add a force to the left
            //rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
            Command moveLeft = new MoveLeft(rb, sidewaysForce);
            Invoker invoker = new Invoker();
            invoker.SetCommand(moveLeft);
            invoker.ExecuteCommand();
        }

        if (rb.position.y < -1f)
        {
            // End game if player falls off ground
            FindObjectOfType<GameManager>().EndGame();
        }
    }
Ejemplo n.º 12
0
    public void MoveRight()
    {
        Icommand command = new MoveRight(position, player);

        CommandManager.instance.AddComponent(command);
        position = position + new Vector3(0, 0, 2);
    }
    void FixedUpdate()
    {
        //Add a forward force on the object
        rb.AddForce(0, 0, forwardsForce * Time.deltaTime);

        //Get user input and move object accordingly
        if (Input.GetKey("d"))
        {
            Command moveRight = new MoveRight(rb, sidewaysForce);
            Invoker invoker   = new Invoker();
            invoker.SetCommand(moveRight);
            invoker.ExecuteCommand();
        }
        if (Input.GetKey("a"))
        {
            Command moveLeft = new MoveLeft(rb, sidewaysForce);
            Invoker invoker  = new Invoker();
            invoker.SetCommand(moveLeft);
            invoker.ExecuteCommand();
        }
        //End game if the object falls off the platform
        if (rb.position.y < -1f)
        {
            FindObjectOfType <GameManager>().EndGame();
        }
    }
Ejemplo n.º 14
0
    // FixedUpdate is called evenly across framerates
    void FixedUpdate()
    {
        //Get the rigidbody by FORCE

        if (replayMode == true)
        {
            if (Invoker.log.Count != 0 && Invoker.log.Peek() != null)
            {
                if (Invoker.log.Peek().timeStart <= Time.timeSinceLevelLoad)
                {
                    currentCommand            = Invoker.log.Dequeue();
                    currentCommand.playerBody = GetComponent <Rigidbody>();
                    invoker.SetCommand(currentCommand, Time.timeSinceLevelLoad, true);
                    //Debug.Log("Changed active movement");
                }

                if (currentCommand != null && currentCommand.timeEnd <= Time.timeSinceLevelLoad)
                {
                    invoker.SetCommand(noMovement, Time.timeSinceLevelLoad, true);
                }
            }
        }
        else
        {
            if (Input.GetKeyDown("d"))
            {
                Command moveRight = new MoveRight(rb, sidewaysForce);
                invoker.SetCommand(moveRight, Time.timeSinceLevelLoad);
            }
            if (Input.GetKeyDown("a"))
            {
                Command moveLeft = new MoveLeft(rb, sidewaysForce);
                invoker.SetCommand(moveLeft, Time.timeSinceLevelLoad);
            }

            if (Input.GetKeyUp("d"))
            {
                invoker.Clear("D");
                //Debug.Log("D up");
            }

            if (Input.GetKeyUp("a"))
            {
                invoker.Clear("A");
                //Debug.Log("A up");
            }
        }
        if (rb.position.y < -1f)
        {
            //End the game if the player goes off the edge
            if (replayMode == true)
            {
                Invoker.log.Clear();
            }
            FindObjectOfType <GameManager>().EndGame();
        }

        rb.AddForce(0, 0, forwardForce * Time.deltaTime);
        invoker.ExecuteCommand();
    }
Ejemplo n.º 15
0
        void ReleaseDesignerOutlets()
        {
            if (MoveUp != null)
            {
                MoveUp.Dispose();
                MoveUp = null;
            }

            if (MoveLeft != null)
            {
                MoveLeft.Dispose();
                MoveLeft = null;
            }

            if (MoveRight != null)
            {
                MoveRight.Dispose();
                MoveRight = null;
            }

            if (MoveDown != null)
            {
                MoveDown.Dispose();
                MoveDown = null;
            }

            if (ZoomLevel != null)
            {
                ZoomLevel.Dispose();
                ZoomLevel = null;
            }
        }
Ejemplo n.º 16
0
 public Option <ListZipper <A> > MoveRightN(int n)
 {
     return(n == 0 ?
            this.Some() :
            n < 0 ?
            MoveLeftN(Math.Abs(n)) :
            MoveRight.SelectMany(z => z.MoveRightN(n - 1)));
 }
Ejemplo n.º 17
0
        void GetRandomBlock()
        {
            int RandomPosition = rand.Next(0, 4);

            switch (RandomBlock)
            {
            case 0:
                t_block   = new T_Block(StartPoint, RandomPosition, BlockSize, board);
                moveLeft  = t_block.MoveLeft;
                moveRight = t_block.MoveRight;
                moveDown  = t_block.MoveDown;
                rotate    = t_block.Rotate;

                BlockColor        = t_block.color;
                returnCoordinates = t_block.returnCoordinates;

                break;

            case 1:
                square    = new Square(StartPoint, BlockSize, board);
                moveLeft  = square.MoveLeft;
                moveRight = square.MoveRight;
                moveDown  = square.MoveDown;
                rotate    = square.Rotate;

                BlockColor        = square.color;
                returnCoordinates = square.returnCoordinates;

                break;

            case 2:
                stick     = new Stick(StartPoint, RandomPosition, BlockSize, board);
                moveLeft  = stick.MoveLeft;
                moveRight = stick.MoveRight;
                moveDown  = stick.MoveDown;
                rotate    = stick.Rotate;

                BlockColor        = stick.color;
                returnCoordinates = stick.returnCoordinates;

                break;

            case 3:
                z_block   = new Z_Block(StartPoint, RandomPosition, BlockSize, board);
                moveLeft  = z_block.MoveLeft;
                moveRight = z_block.MoveRight;
                moveDown  = z_block.MoveDown;
                rotate    = z_block.Rotate;

                BlockColor        = z_block.color;
                returnCoordinates = z_block.returnCoordinates;
                break;

            //
            default:
                break;
            }
        }
Ejemplo n.º 18
0
        private static void BindKeys()
        {
            buttonW = new MoveForward();
            buttonS = new MoveBackward();
            buttonA = new MoveLeft();
            buttonD = new MoveRight();

            //buttonZ = new MoveForward();
        }
Ejemplo n.º 19
0
    public Vec2 NeedVel()
    {
        Vec2 t = Vec2.Zero;

        t += MoveLeft.Pressed() ? new Vec2(-1, 0) : Vec2.Zero;
        t += MoveRight.Pressed() ? new Vec2(1, 0) : Vec2.Zero;
        t += MoveDown.Pressed() ? new Vec2(0, -1) : Vec2.Zero;
        return(t);
    }
Ejemplo n.º 20
0
 public void Schoolyard()
 {
     if (!schoolyard)
     {
         MoveRight instanceOfMoveRight = GameObject.Find("Location").GetComponent <MoveRight>();
         instanceOfMoveRight.changeText("Schoolyard");
         schoolyard = true;
     }
 }
Ejemplo n.º 21
0
    void FixedUpdate()
    {
        //this is a standtard push that scales diretly to frame rate
        //Time.deltaTime negates the frame rate diffirences and the really high number helps the cube to actually move

        rb.AddForce(0, 0, forwardSpeed * Time.deltaTime);


        if (Input.GetKey("d"))
        {
            Command _moveRight = new MoveRight(rb, lateralSpeed);
            Invoker invoker    = new Invoker();
            invoker.SetCommand(_moveRight);

            invoker.ExecuteComand();
            //commandDisplay.text += "\n" + _moveRight.ToString();
        }

        if (Input.GetKey("a"))
        {
            Command _moveLeft = new MoveLeft(rb, lateralSpeed);
            Invoker invoker   = new Invoker();
            invoker.SetCommand(_moveLeft);
            //  commandDisplay.text += "\n" + _moveLeft.ToString();
            invoker.ExecuteComand();
        }

        if (Input.GetKey("w"))
        {
            Command _moveUp = new MoveUp(rb, lateralSpeed);
            Invoker invoker = new Invoker();
            invoker.SetCommand(_moveUp);
            //   commandDisplay.text += "\n" + _moveUp.ToString();
            invoker.ExecuteComand();
        }

        if (Input.GetKey("s"))
        {
            //loacal _moveDown  //calling the command in commmand
            Command _moveDown = new MoveDown(rb, lateralSpeed);
            Invoker invoker   = new Invoker();
            invoker.SetCommand(_moveDown);
            //  commandDisplay.text += "\n" + _moveDown.ToString();
            invoker.ExecuteComand();
        }

        if (rb.position.y < -1f)
        {
            FindObjectOfType <GameManager>().EndGame();
        }

        if (rb.GetComponentInParent <Transform>().position.z > halfWay)
        {
            OnHalfWay?.Invoke();
        }
    }
Ejemplo n.º 22
0
    private void Start()
    {
        prevMoves = new Stack <char>();
        pc        = new PlayerController(player);

        leftCommand    = new MoveLeft(pc);
        rightCommand   = new MoveRight(pc);
        backCommand    = new MoveBack(pc);
        forwardCommand = new MoveForward(pc);
    }
Ejemplo n.º 23
0
 public InputHandler(Player player, TileMapFacade tileMapFacade)
 {
     this._player  = player;
     this._tilemap = tileMapFacade;
     //Bind keys with commands
     buttonW = new MoveForward();
     buttonS = new MoveBackward();
     buttonA = new MoveLeft();
     buttonD = new MoveRight();
 }
Ejemplo n.º 24
0
        void GetRandomBlock()
        {
            int RandomPosition = rand.Next(0, 4);

            switch (RandomBlock)
            {
                case 0:
                    t_block = new T_Block(StartPoint, RandomPosition, BlockSize,board);
                    moveLeft = t_block.MoveLeft;
                    moveRight = t_block.MoveRight;
                    moveDown = t_block.MoveDown;
                    rotate = t_block.Rotate;

                    BlockColor = t_block.color;
                    returnCoordinates = t_block.returnCoordinates;

                    break;
                case 1:
                    square = new Square(StartPoint, BlockSize,board);
                    moveLeft = square.MoveLeft;
                    moveRight = square.MoveRight;
                    moveDown = square.MoveDown;
                    rotate = square.Rotate;

                    BlockColor = square.color;
                    returnCoordinates = square.returnCoordinates;

                    break;
                case 2:
                    stick = new Stick(StartPoint, RandomPosition, BlockSize,board);
                    moveLeft = stick.MoveLeft;
                    moveRight = stick.MoveRight;
                    moveDown = stick.MoveDown;
                    rotate = stick.Rotate;

                    BlockColor = stick.color;
                    returnCoordinates = stick.returnCoordinates;

                    break;
                case 3:
                    z_block = new Z_Block(StartPoint, RandomPosition, BlockSize,board);
                    moveLeft = z_block.MoveLeft;
                    moveRight = z_block.MoveRight;
                    moveDown = z_block.MoveDown;
                    rotate = z_block.Rotate;

                    BlockColor = z_block.color;
                    returnCoordinates = z_block.returnCoordinates;
                    break;
                //
                default:
                    break;

            }
        }
        public void Update()
        {
            //Check keys in keymap
            //Has Released Keys
            foreach (var item in keyMap.OnReleasedKeyMap)
            {
                if (Input.GetKeyUp(item.Key))
                {
                    Debug.Log(string.Format("onReleasedKeyMap Key released {0}", item.Value.ToString())); //Log key to console
                    Command command = null;
                    switch (item.Value)
                    {
                    case "Move Up":
                        //trigger Move Up command
                        command = new MoveUp();
                        break;

                    case "Move Down":
                        //trigger Move Down command
                        command = new MoveDown();
                        break;

                    case "Move Left":
                        //trigger Move Left command
                        command = new MoveLeft();
                        break;

                    case "Move Right":
                        //trigger Move Down command
                        command = new MoveRight();
                        break;

                    case "Undo":
                        if (Commands.Count > 0)
                        {
                            command = (Command)Commands.Pop();
                            if (command is ICommandWithUndo)     //if the popped command has an undo command use it
                            {
                                command = ((ICommandWithUndo)command).UndoCommand;
                            }
                        }
                        break;
                    }
                    if (command != null)
                    {
                        if (command is ICommandWithUndo)
                        {
                            Commands.Push((ICommandWithUndo)command); //only push commands with undo to the stack
                        }
                        command.Execute(MoveCommandTarget);
                    }
                }
            }
        }
Ejemplo n.º 26
0
    void Start()
    {
        //Bind keys with commands
        buttonB = new DoNothing();
        buttonW = new MoveUp();
        buttonS = new MoveDown();
        buttonA = new MoveLeft();
        buttonD = new MoveRight();

        elementStartPos = elementTrans.position;
    }
Ejemplo n.º 27
0
    private void OnTick(object sender, float duration)
    {
        if (Input.GetKey(KeyCode.D))
        {
            MoveRight?.Invoke(this, duration);
        }

        if (Input.GetKey(KeyCode.A))
        {
            MoveLeft?.Invoke(this, duration);
        }
    }
        public override void Update(GameTime gameTime)
        {
            var kstate = Keyboard.GetState();

            if (kstate.IsKeyDown(slowMode))
            {
                speed = (speed == originalSpeed) ? speed / slowModeModifier : speed * slowModeModifier;
            }

            if (kstate.IsKeyDown(godMode) && pastKey.IsKeyUp(godMode))
            {
                isGod = !isGod;
            }

            // for testing the win states
            if (kstate.IsKeyDown(win) && pastKey.IsKeyUp(win))
            {
                winner = 1; // win -> see win screen
            }
            //for testing lose life
            if (kstate.IsKeyDown(hit) && pastKey.IsKeyUp(hit))
            {
                if (invincible == false)
                {
                    takeHit(); //player is hit
                }
            }

            if (kstate.IsKeyDown(upKey))
            {
                position = new MoveUp(speed).getNewPosition(position, velocity);
            }
            if (kstate.IsKeyDown(downKey))
            {
                position = new MoveDown(speed).getNewPosition(position, velocity);
            }
            if (kstate.IsKeyDown(leftKey))
            {
                position = new MoveLeft(speed).getNewPosition(position, velocity);
            }
            if (kstate.IsKeyDown(rightKey))
            {
                position = new MoveRight(speed).getNewPosition(position, velocity);
            }
            if (kstate.IsKeyDown(shootKey) && pastKey.IsKeyUp(shootKey))
            {
                shoot();
            }
            pastKey = Keyboard.GetState();

            bulletsUpdateAndCleanup(gameTime);
        }
    // Update is called per tick
    void FixedUpdate()
    {
        rb.AddForce(0, -9.8f * Time.deltaTime, 0);

        if (bIsReplaying)
        {
            return; //Running a replay, ignore active inputs
        }


        if (Input.GetKey("d")) //Move Right
        {
            //rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
            Command moveRight = new MoveRight(rb, sidewaysForce);
            Invoker invoker   = new Invoker();
            invoker.SetCommand(moveRight);
            invoker.ExecuteCommand();
        }


        if (Input.GetKey("a")) //Move Left
        {
            //rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
            Command moveLeft = new MoveLeft(rb, sidewaysForce);
            Invoker invoker  = new Invoker();
            invoker.SetCommand(moveLeft);
            invoker.ExecuteCommand();
        }

        if (Input.GetKey("w")) //Move Forward
        {
            //rb.AddForce(0, 0, sidewaysForce * Time.deltaTime, ForceMode.VelocityChange);
            Command moveForward = new MoveForward(rb, forwardForce);
            Invoker invoker     = new Invoker();
            invoker.SetCommand(moveForward);
            invoker.ExecuteCommand();
        }

        if (Input.GetKey("s")) //Move Backwards
        {
            //rb.AddForce(0, 0, -sidewaysForce * Time.deltaTime, ForceMode.VelocityChange);
            Command moveBack = new MoveBack(rb, forwardForce);
            Invoker invoker  = new Invoker();
            invoker.SetCommand(moveBack);
            invoker.ExecuteCommand();
        }

        if (rb.position.y < -2f)
        {//Reset if off the map
            FindObjectOfType <game_manager>().GameEnd();
        }
    }
Ejemplo n.º 30
0
        public void SetCommandTest()
        {
            Player player = new Player("id", "username", 0);

            player.SetPos(50, 50);
            Map       map       = new Map(23 * 25, 19 * 25);
            MapFacade mapFacade = map.mapFacade;
            ICommand  command   = new MoveRight(player, mapFacade);

            player.SetCommand(command);
            player.Move();
            Assert.IsTrue(50 != player.x || 50 != player.y);
        }
Ejemplo n.º 31
0
 void Start()
 {
     moveforward  = new MoveFoward();
     movebackward = new MoveBackward();
     moveright    = new MoveRight();
     moveleft     = new MoveLeft();
     jump         = new Jump();
     forwardkey   = KeyCode.W;
     backwardkey  = KeyCode.S;
     leftkey      = KeyCode.A;
     rightkey     = KeyCode.D;
     jumpkey      = KeyCode.Space;
 }