Пример #1
0
 internal EnumFacing(FacingEnum type, int orderA, int orderB, int frontOffsetX, int frontOffsetY, int frontOffsetZ)
 {
     this.Enum = type;
     this.OrderA = orderA;
     this.OrderB = orderB;
     this.FrontOffsetX = frontOffsetX;
     this.FrontOffsetY = frontOffsetY;
     this.FrontOffsetZ = frontOffsetZ;
 }
Пример #2
0
 public void MoveRight()
 {
     gameObject.transform.Translate(speed, 0, 0);
     if (facing < FacingEnum.Up)
     {
         facing = FacingEnum.Right;
     }
     else
     {
         facing = FacingEnum.UpRight;
     }
 }
Пример #3
0
 public void MoveLeft()
 {
     gameObject.transform.Translate(-speed, 0, 0);
     if (facing < FacingEnum.Up)
     {
         facing = FacingEnum.Left;
     }
     else
     {
         facing = FacingEnum.UpLeft;
     }
 }
Пример #4
0
        public void TurnRight_ForAllFacings_TurnTheRobotToRight(FacingEnum facing, FacingEnum expectedFacing)
        {
            _order1.CurrentState = new StateOfRobot {
                Cell = new Cell {
                    Point = new Point(1, 1), State = CellStateEnum.StateS
                }, Faceing = facing
            };
            _order1.Commands = new List <CommandEnum> {
                CommandEnum.TR
            };

            var cleanService = new CleanService(_order1);

            var result = cleanService.Start();

            Assert.That(expectedFacing, Is.EqualTo(result.FinalState.Faceing));
        }
Пример #5
0
        private void GatherInputs()
        {
            Vector2 Vel = Velocity;
            float   horizontalAxisValue = GatherHorizontalAxisValue();

            Vel.X = IncreaseVelocityBasedOnInput(Vel.X, horizontalAxisValue);

            if (horizontalAxisValue < -Constants.Instance.GamepadDeadband)
            {
                CurrentFacing = FacingEnum.Left;
            }
            else if (horizontalAxisValue > Constants.Instance.GamepadDeadband)
            {
                CurrentFacing = FacingEnum.Right;
            }


            if (collider.OnGround)
            {
                JumpDirection     = JumpDirectionEnum.None;
                WallJumpAvailable = true;
                JumpAvailable     = true;
                Vel = HandleJump(Vel);
            }
            else
            {
                if (CanWallJump && WallJumpAvailable)
                {
                    Vel = HandleWallJump(Vel, horizontalAxisValue);
                }

                //If we allow the user some jump forgiveness, then check for a jump. Note that wall jumps currently disable this ability,
                //so we check for that first.
                if (AllowJumpForgiveness && JumpAvailable)
                {
                    Vel = HandleJump(Vel);
                }
            }

            Velocity = Vel;
        }
Пример #6
0
 public void StartFacingUp()
 {
     facing = FacingEnum.Up + (int)facing + 1;
 }
Пример #7
0
 public void StopFacingUp()
 {
     facing -= 3;
 }
Пример #8
0
        public void Advance_EverythingNormalForForward_RobotShouldGoNextPoint(int x, int y, FacingEnum facing, int expectedX, int expectedY)
        {
            _order1.CurrentState = new StateOfRobot {
                Cell = new Cell {
                    Point = new Point(x, y), State = CellStateEnum.StateS
                }, Faceing = facing
            };
            _order1.Commands = new List <CommandEnum> {
                CommandEnum.A
            };

            var cleanService = new CleanService(_order1);

            var result = cleanService.Start();

            Assert.That(expectedX, Is.EqualTo(result.FinalState.Cell.Point.X));
            Assert.That(expectedY, Is.EqualTo(result.FinalState.Cell.Point.Y));
            Assert.That(_order1.Battery, Is.EqualTo(78));
        }