コード例 #1
0
 private void SetNextState( float second, DrawState state )
 {
     _addPosition = new Vector2(((state.Position.X - CurrentState.Position.X) / second / FPS),
         ((state.Position.Y - CurrentState.Position.Y) / second / FPS));
     _addSize = new Vector2(((state.Size.X - CurrentState.Size.X) / second / FPS),
         ((state.Size.Y - CurrentState.Size.Y) / second / FPS));
     Vector3 color = state.Color.ToVector3(), currentColor = CurrentState.Color.ToVector3();
     _addColor = new Vector3(((color.X - currentColor.X) / second / FPS),
         ((color.Y - currentColor.Y) / second / FPS),
         ((color.Z - currentColor.Z) / second / FPS));
     _addframe = (int)(second * (float)FPS) + 1;
     _goalState = state;
 }
コード例 #2
0
        public void Update()
        {
            if (_addframe > 0)
            {
                CurrentState.Bounds = new Vector4( CurrentState.Position.X + _addPosition.X,
                    CurrentState.Position.Y + _addPosition.Y,
                    CurrentState.Size.X + _addPosition.X,
                    CurrentState.Size.Y + _addPosition.Y );

                Vector3 color = CurrentState.Color.ToVector3();
                CurrentState.Color = new Color(color.X + _addColor.X,
                    color.Y + _addColor.Y, color.Z + _addColor.Z);

                --_addframe;
                if (_addframe <= 0) CurrentState = _goalState;
            }
            else if (_stateQueue.Count > 0)
            {
                _goalState = _stateQueue.Dequeue();
                SetNextState(_stateChangeSecondQueue.Dequeue(), _goalState);
            }
        }
コード例 #3
0
ファイル: Container.cs プロジェクト: sinmaplewing/nQueenGame
 public Container(Game game, Texture2D background, DrawState state)
     : base(game)
 {
     _background = background;
     _state = new StateManager(game, state);
 }
コード例 #4
0
ファイル: Scene.cs プロジェクト: sinmaplewing/nQueenGame
 public Scene(Game game, Texture2D background, DrawState state)
     : base(game, background, state)
 {
 }
コード例 #5
0
 public void AddState(float second, DrawState state)
 {
     _stateChangeSecondQueue.Enqueue(second);
     _stateQueue.Enqueue(state);
 }
コード例 #6
0
 public StateManager(Game game, DrawState state)
     : base(game)
 {
     CurrentState = state;
 }