Example #1
0
 public void Execute()
 {
     if (!IsActive)
     {
         return;
     }
     _motor.Move();
 }
Example #2
0
 public void OnUpdate()
 {
     if (!IsActive)
     {
         return;
     }
     _motor.Move();
 }
Example #3
0
 public override void Update()
 {
     if (!IsActive)
     {
         return;
     }
     _motor.Move();
 }
Example #4
0
        public void LeftTurnsOrientation(ORIENTATION start, ORIENTATION finish)
        {
            var initialLocation = new Location(9266, 90210, start);

            var newLocation = motor.Move(initialLocation);

            Assert.That(newLocation.Coordinate.X, Is.EqualTo(9266));
            Assert.That(newLocation.Coordinate.Y, Is.EqualTo(90210));
            Assert.That(newLocation.Orientation, Is.EqualTo(finish));
        }
Example #5
0
        private void OnMove(InputAction.CallbackContext context)
        {
            var direction2D = context.ReadValue <Vector2>();
            var direction   = new Vector3 {
                x = direction2D.x,
                y = 0,
                z = direction2D.y
            };

            moter.Move(direction);
        }
        public void MotorMovesForward()
        {
            var initialLocation  = new Location(9266, 90210, ORIENTATION.EAST);
            var mockForwardMotor = new Mock <IForwardMotor>();
            var forwardLocation  = new Location(42, 600, ORIENTATION.NORTH);

            mockForwardMotor.Setup(m => m.Move(initialLocation)).Returns(forwardLocation);
            mockMotorFactory.Setup(f => f.ConstructForwardFor(ORIENTATION.EAST)).Returns(mockForwardMotor.Object);

            var newLocation = motor.Move(initialLocation);

            Assert.That(newLocation, Is.EqualTo(forwardLocation));
        }
Example #7
0
        public void Execute()
        {
            if (!IsActive)
            {
                return;
            }
            if (_playerModel.Hp <= 0)
            {
                Off();
            }

            _motor.Move();

            UiInterface.PlayerXpUiText.Text = _playerModel.Hp;
            UiInterface.PlayerXpUiBar.Fill  = _playerModel.PercentXp;
        }
Example #8
0
        private void Update()
        {
            Vector3 thisPosition = transform.position;

            if (_targetTransform != null)
            {
                _targetPosition = _targetTransform.position;
            }

            if (Vector3.Distance(thisPosition, _targetPosition) > 0.01f)
            {
                _motor.Move((_targetPosition - thisPosition).normalized);
            }
            else
            {
                _motor.Stop();
            }
        }
Example #9
0
 public void Update()
 {
     spawnDelta += Time.deltaTime;
     if (Vector3.Distance(this.gameObject.transform.position, _target.gameObject.transform.position) > _range)
     {
         _motor.Move(Vector3.forward, _speed);
         _isWalking = true;
     }
     else
     {
         _isWalking = false;
         if (spawnDelta >= hitSpeed)
         {
             HitPlayer(zombiePower);
             spawnDelta = 0.0f;
         }
     }
     _animator.SetBool(ZombieAnimationConstants.IsWalkingParamName, _isWalking);
     _motor.Look(_target);
 }
Example #10
0
        public static void MoveAndWait(this IMotor mtr, float position)
        {
            // sync used to wait for move in first axis before proceeding to second axis
            object sync = new object();
            // flag to avoid deadlock in case notify() is called before before the sync-block after each Move()
            bool move_completed = false;
            StrongTypedEventHandler <IMotor, MoveCompletedArgs> notify =
                (motor, args) => { lock (sync) { move_completed = true;  Monitor.Pulse(sync); } };

            mtr.MoveCompleted += notify;
            try
            {
                mtr.Move(position);
                lock (sync) { if (!move_completed)
                              {
                                  Monitor.Wait(sync);
                              }
                }
            }
            finally
            {
                mtr.MoveCompleted -= notify;
            }
        }
Example #11
0
 public void OnUpdate()
 {
     _motor.Move();
 }
Example #12
0
 public void Execute()
 {
     _motor.Move();
 }