예제 #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;
            };
        }
예제 #3
0
        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;
            };
        }
예제 #4
0
파일: Boost.cs 프로젝트: EugeneWang/ShootR
 public Boost(ShipMovementController movementController, ValueRef<bool> controllable)
     : base(NAME, movementController)
 {
     _controllable = controllable;
 }
예제 #5
0
 public Boost(ShipMovementController movementController, ValueRef <bool> controllable)
     : base(NAME, movementController)
 {
     _controllable = controllable;
 }