Ejemplo n.º 1
0
        public void Test_Fei2()
        {
            var floor  = new Floor(data);
            var player = floor.Player;

            floor.PrintFloor();

            Assert.False(player.Move(Direction.right));
            player.Attack();
            floor.PrintFloor();
            Assert.True(player.Move(Direction.right));
            floor.PrintFloor();

            int[] moves = { 2, 2, 2, 3, 4, 4 };
            Assert.True(player.Move(DirectionExtend.GetDirections(moves)));
            floor.PrintFloor();
            player.Attack();
            floor.PrintFloor();

            moves = new int[] { 4, 4, 4, 4, 4,
                                2, 3, 3, 4, 4,
                                4, 4 };
            Assert.True(player.Move(DirectionExtend.GetDirections(moves)));
            floor.PrintFloor();
            Assert.AreEqual(floor.StairPosition, player.Position);
        }
Ejemplo n.º 2
0
        public void PlayerHasAttacked()
        {
            var floor  = new Floor(data);
            var player = floor.Player;

            int[] moves = { 2, 2, 2, 2, 2,
                            2, 2, 0, 0, 0,
                            0, 6, 6, 6, 6,
                            6 };
            player.Move(DirectionExtend.GetDirections(moves));
            Debug.Log(player.Position);
            floor.PrintFloor();
            Assert.AreEqual(State.Dead, player.state);
        }
Ejemplo n.º 3
0
        public void Test_Fei1()
        {
            var floor  = new Floor(data);
            var player = floor.Player;

            int[] wrongMoves = new int[18];
            for (int i = 0; i < wrongMoves.Length; i++)
            {
                wrongMoves[i] = Random.Range(0, 7);
            }
            player.Move(DirectionExtend.GetDirections(wrongMoves));
            Assert.AreNotEqual((8, 8), player.Position);

            floor  = new Floor(data);
            player = floor.Player;
            int[] correctMoves = { 4, 4, 5, 3, 3,
                                   2, 2, 1, 7, 7,
                                   1, 2, 2, 3, 3,
                                   5, 4, 4 };
            player.Move(DirectionExtend.GetDirections(correctMoves));
            Assert.AreEqual(floor.StairPosition, player.Position);
        }
Ejemplo n.º 4
0
    public bool Move(params int[] indexes)
    {
        var directions = DirectionExtend.GetDirections(indexes);

        return(Move(directions));
    }