コード例 #1
0
ファイル: SpartaGroup.cs プロジェクト: tvalle/Sparta
        public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch, SpriteSortMode parentSortMode, BlendState parentBlendState)
        {
            if (Count == 0)
            {
                return;
            }

            int statesObjectsCount = Count;

            SpartaObject[] stateObjects = Array;
            for (int i = 0; i < statesObjectsCount; i++)
            {
                SpartaDrawable stateObject = stateObjects[i] as SpartaDrawable;
                if (stateObject == null)
                {
                    continue;
                }
                else if (stateObject is SpartaCamera2D)
                {
                    ((SpartaCamera2D)stateObject).Draw(gameTime, spriteBatch, parentSortMode, parentBlendState);
                }
                else
                {
                    stateObject.Draw(gameTime, spriteBatch);
                }
            }
        }
コード例 #2
0
ファイル: SpartaState.cs プロジェクト: tvalle/Sparta
 protected virtual void OnModeChanged(SpartaStateMode oldMode, SpartaStateMode newMode)
 {
     if (newMode == SpartaStateMode.TransitionIn)
     {
         if (TransitionIn.transitionType != SpartaTransitionType.None)
         {
             if (BackBuffer == null)
             {
                 BackBuffer = CreateBackBuffer();
             }
         }
         SpartaTransitionAnimation.HandleTransition(this, animationEnded, TransitionIn);
     }
     else if (newMode == SpartaStateMode.TransitionOff)
     {
         if (TransitionOut.transitionType != SpartaTransitionType.None)
         {
             if (BackBuffer == null)
             {
                 BackBuffer = CreateBackBuffer();
             }
         }
         SpartaTransitionAnimation.HandleTransition(this, animationEnded, TransitionOut);
     }
     else
     {
         if (newMode == SpartaStateMode.Activated)
         {
             TransitionIn.transitionType  = SpartaTransitionType.None;
             TransitionOut.transitionType = SpartaTransitionType.None;
             DrawPriority = false;
         }
         Transform = Matrix.Identity;
     }
 }
コード例 #3
0
ファイル: SpartaState.cs プロジェクト: tvalle/Sparta
 public override void Dispose()
 {
     if (TransitionAnimation != null)
     {
         TransitionAnimation.Dispose();
         TransitionAnimation = null;
     }
     if (BackBuffer != null)
     {
         BackBuffer.Dispose();
         BackBuffer = null;
     }
     base.Dispose();
 }
コード例 #4
0
ファイル: SpartaCamera2D.cs プロジェクト: tvalle/Sparta
        protected virtual void UpdateOpacity(float opacity, SpartaObject[] children, int count)
        {
            if (count == 0)
            {
                return;
            }

            for (int i = 0; i < count; i++)
            {
                SpartaDrawable drawable = children[i] as SpartaDrawable;
                if (drawable == null)
                {
                    return;
                }
                drawable.Opacity = opacity;
            }
        }
コード例 #5
0
ファイル: SpartaGroup.cs プロジェクト: tvalle/Sparta
        public virtual void LoadContent()
        {
            if (Count == 0)
            {
                return;
            }

            int statesObjectsCount = Count;

            SpartaObject[] stateObjects = Array;
            for (int i = 0; i < statesObjectsCount; i++)
            {
                SpartaDrawable stateObject = stateObjects[i] as SpartaDrawable;
                if (stateObject == null)
                {
                    continue;
                }
                stateObject.LoadContent();
            }
        }
コード例 #6
0
ファイル: SpartaCamera2D.cs プロジェクト: tvalle/Sparta
 public void Follow(SpartaDrawable item)
 {
 }