Beispiel #1
0
        public override void Activate()
        {
            ShipMovementController smc = _movementController as ShipMovementController;

            smc.StopMovement();
            smc.Moving.Forward = true;

            _controllable.Value = false;
            MultiplySpeedBy(SPEED_INCREASE);
            base.Activate();
        }
        public ShipInterpolationManager(ShipMovementController movementController)
        {
            _movementController = movementController;
            _positionTween      = new Vector2Tween(Vector2.Zero, Vector2.Zero, 1);
            _rotationTween      = new NumberTween(0, 0, 1);
            _tweensComplete     = 0;
            _lock       = new object();
            _onComplete = () =>
            {
                lock (_lock)
                {
                    if (++_tweensComplete % 2 == 0)
                    {
                        Interpolating   = false;
                        _tweensComplete = 0;
                    }
                }
            };

            _positionTween.OnComplete += (_) =>
            {
                _onComplete();
            };

            _rotationTween.OnComplete += (_) =>
            {
                _onComplete();
            };

            _positionTween.OnChange += (newPosition) =>
            {
                _movementController.Position = newPosition;
            };

            _rotationTween.OnChange += (newRotation) =>
            {
                _movementController.Rotation = newRotation;
            };
        }
        public ShipInterpolationManager(ShipMovementController movementController)
        {
            _movementController = movementController;
            _positionTween = new Vector2Tween(Vector2.Zero, Vector2.Zero, 1);
            _rotationTween = new NumberTween(0, 0, 1);
            _tweensComplete = 0;
            _lock = new object();
            _onComplete = () =>
            {
                lock (_lock)
                {
                    if (++_tweensComplete % 2 == 0)
                    {
                        Interpolating = false;
                        _tweensComplete = 0;
                    }
                }
            };

            _positionTween.OnComplete += (_) =>
            {
                _onComplete();
            };

            _rotationTween.OnComplete += (_) =>
            {
                _onComplete();
            };

            _positionTween.OnChange += (newPosition) =>
            {
                _movementController.Position = newPosition;
            };

            _rotationTween.OnChange += (newRotation) =>
            {
                _movementController.Rotation = newRotation;
            };
        }
Beispiel #4
0
 public Boost(ShipMovementController movementController, ValueRef<bool> controllable)
     : base(NAME, movementController)
 {
     _controllable = controllable;
 }
Beispiel #5
0
 public Boost(ShipMovementController movementController, ValueRef <bool> controllable)
     : base(NAME, movementController)
 {
     _controllable = controllable;
 }