public override Timeline Copy(AnimationClass.AnimationLayer ActiveLayer) { AnimationOriginTimeline NewSetAnimationOriginEvent = new AnimationOriginTimeline(); NewSetAnimationOriginEvent.UpdateFrom(this, ActiveLayer); return(NewSetAnimationOriginEvent); }
private GameEngineLayer() : this(null) { AnimationOrigin = new AnimationOriginTimeline(); AnimationOrigin.DicAnimationKeyFrame.Add(0, new VisibleAnimationObjectKeyFrame(new Vector2(275, 320), true, -1)); List <Timeline> ListGameEngineTimeline = new List <Timeline>(); ListGameEngineTimeline.Add(new BackgroundTimeline()); ListGameEngineTimeline.Add(new QuoteSetTimeline()); ListGameEngineTimeline.Add(new SFXTimeline()); ListGameEngineTimeline.Add(AnimationOrigin); DicTimelineEvent.Add(0, ListGameEngineTimeline); }
public override void LoadLayer(BinaryReader BR, Microsoft.Xna.Framework.Content.ContentManager Content, Dictionary <string, Timeline> DicTimeline) { DicTimelineEvent = new Dictionary <int, List <Timeline> >(5); DicTimelineEvent.Add(0, new List <Timeline>()); int ListEventCount = BR.ReadInt32(); for (int E = 0; E < ListEventCount; E++) { Timeline ActiveEvent = Timeline.Load(BR, Content, this, DicTimeline); DicTimelineEvent[0].Add(ActiveEvent); } AnimationOrigin = (AnimationOriginTimeline)DicTimelineEvent[0][3]; }
public void DrawLayer(CustomSpriteBatch g, AnimationLayer ActiveLayer, bool DrawMarker, AnimationLayer Parent, bool DrawChild = true) { if (DrawChild) { //TODO: Don't use Begin to use the transformationMatrix as it force the rendering making it impossible to properly use the drawing depth. if (ActiveLayer.LayerBlendState == AnimationLayer.LayerBlendStates.Add) { g.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, ActiveLayer.SamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, TransformationMatrix); } else if (ActiveLayer.LayerBlendState == AnimationLayer.LayerBlendStates.Substract) { g.Begin(SpriteSortMode.BackToFront, NegativeBlendState, ActiveLayer.SamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, TransformationMatrix); } else { GraphicsDevice.Clear(ClearOptions.Stencil, Color.Black, 0, 0); g.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, AlwaysStencilState, null, null); DrawLayer(g, Parent, false, null, false); g.Begin(SpriteSortMode.Immediate, null, SamplerState.PointClamp, EqualStencilState, null, null); for (int A = 0; A < ActiveLayer.ListVisibleObject.Count; A++) { ActiveLayer.ListVisibleObject[A].Draw(g, false); } } } for (int A = 0; A < ActiveLayer.ListVisibleObject.Count; A++) { ActiveLayer.ListVisibleObject[A].Draw(g, false); } if (DrawMarker) { for (int M = 0; M < ActiveLayer.ListActiveMarker.Count; M++) { AnimationClass ActiveMarkerAnimation = ActiveLayer.ListActiveMarker[M].AnimationMarker; AnimationOriginTimeline ActiveMarkerOrigin = ActiveMarkerAnimation.AnimationOrigin; for (int L = 0; L < ActiveMarkerAnimation.ListAnimationLayer.BasicLayerCount; L++) { SpriteEffects ActiveEffect = SpriteEffects.None; if (ActiveLayer.ListActiveMarker[M].ScaleFactor.X < 0) { ActiveEffect = SpriteEffects.FlipHorizontally; } if (ActiveLayer.ListActiveMarker[M].ScaleFactor.Y < 0) { ActiveEffect |= SpriteEffects.FlipVertically; } int OriginX = (int)ActiveMarkerOrigin.Position.X; if ((ActiveEffect & SpriteEffects.FlipHorizontally) == SpriteEffects.FlipHorizontally) { OriginX = Constants.Width - (int)ActiveMarkerOrigin.Position.X; } g.Draw(ActiveMarkerAnimation.ListAnimationLayer[ActiveMarkerAnimation.ListAnimationLayer.BasicLayerCount - L - 1].renderTarget, new Vector2(ActiveLayer.ListActiveMarker[M].Position.X, ActiveLayer.ListActiveMarker[M].Position.Y), null, Color.White, 0, new Vector2(OriginX, ActiveMarkerOrigin.Position.Y), new Vector2(Math.Abs(ActiveLayer.ListActiveMarker[M].ScaleFactor.X), Math.Abs(ActiveLayer.ListActiveMarker[M].ScaleFactor.Y)), ActiveEffect, ActiveLayer.ListActiveMarker[M].DrawingDepth); } } } g.End(); if (DrawChild) { for (int L = 0; L < ActiveLayer.ListChildren.Count; L++) { DrawLayer(g, ActiveLayer.ListChildren[L], DrawMarker, ActiveLayer, true); } } }