Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns>Timelines by Key Frames</returns>
        public override Dictionary <int, Timeline> GetExtraTimelines(AnimationClass NewAnimation)
        {
            MagicProjectileSandboxStartAnimation AnimationStartSandbox = GetAnimationStartSandbox(NewAnimation.AnimationOrigin.Position);

            Dictionary <int, Timeline> DicExtraTimeline = new Dictionary <int, Timeline>();
            MagicTimeline NewTimeline = new MagicTimeline(new MagicSpell(Owner, Owner.GlobalContext.ActiveTarget), GlobalContext, SharedParams);

            NewTimeline.DeathFrame = AnimationStartSandbox.TotalSimulationFrames;
            NewAnimation.LoopEnd   = Math.Max(NewAnimation.LoopEnd, NewTimeline.DeathFrame);

            for (int i = 0; i < NewAnimation.ListAnimationLayer.BasicLayerCount; ++i)
            {
                foreach (KeyValuePair <int, List <Timeline> > Timelines in NewAnimation.ListAnimationLayer[i].DicTimelineEvent)
                {
                    foreach (Timeline ActiveTimeline in Timelines.Value)
                    {
                        ActiveTimeline.DeathFrame = Math.Max(ActiveTimeline.DeathFrame, NewTimeline.DeathFrame);
                    }
                }
            }
            DicExtraTimeline.Add(0, NewTimeline);

            SharedParams.OwnerPosition = NewAnimation.AnimationOrigin.Position;
            SharedParams.OwnerAngle    = 0;

            return(DicExtraTimeline);
        }
Beispiel #2
0
        private Rectangle GetEnemyPosition()
        {
            float MinX = float.MaxValue;
            float MinY = float.MaxValue;
            float MaxX = float.MinValue;
            float MaxY = float.MinValue;

            AnimationClass EnemyAnimation = Owner.ListAnimationLayer[0].ListActiveMarker[0].AnimationMarker;

            foreach (VisibleTimeline ActiveObject in EnemyAnimation.ListAnimationLayer[0].ListVisibleObject)
            {
                if (ActiveObject.Position.X < MinX)
                {
                    MinX = ActiveObject.Position.X;
                }
                if (ActiveObject.Position.X + ActiveObject.Width > MaxX)
                {
                    MaxX = ActiveObject.Position.X + ActiveObject.Width;
                }

                if (ActiveObject.Position.Y < MinY)
                {
                    MinY = ActiveObject.Position.Y;
                }
                if (ActiveObject.Position.Y + ActiveObject.Height > MaxY)
                {
                    MaxY = ActiveObject.Position.Y + ActiveObject.Height;
                }
            }

            return(new Rectangle((int)MinX, (int)MinY, (int)(MaxX - MinX), (int)(MaxY - MinY)));
        }
Beispiel #3
0
        public static void InitBattleAnimation(AnimationClass EnemyUnitAnimation, AnimationClass EnemyUnitAnimationAfterDamage, string EnemyUnitDeathAnimation)
        {
            int NumberOfEnemies            = EnemyUnitAnimation.ListAnimationLayer[0].ListActiveMarker.Count;
            int NumberOfEnemiesAfterDamage = EnemyUnitAnimationAfterDamage.ListAnimationLayer[0].ListActiveMarker.Count;
            int NumberOfDeadEnemies        = NumberOfEnemies - NumberOfEnemiesAfterDamage;

            List <int> ListUnitAnimationIndex = new List <int>();
            Random     Random     = new Random();
            int        DeathFrame = EnemyUnitAnimation.ListAnimationLayer[0].ListActiveMarker[0].DeathFrame;

            for (int i = 0; i < NumberOfEnemies; ++i)
            {
                ListUnitAnimationIndex.Add(i);
            }

            for (int i = 0; i < NumberOfDeadEnemies; ++i)
            {
                int            ActiveIndex        = ListUnitAnimationIndex[Random.Next(ListUnitAnimationIndex.Count)];
                MarkerTimeline ActiveUnitTimeline = EnemyUnitAnimation.ListAnimationLayer[0].ListActiveMarker[ActiveIndex];

                ActiveUnitTimeline.AnimationMarker             = new AnimationClass(EnemyUnitDeathAnimation);
                ActiveUnitTimeline.AnimationMarker.DicTimeline = EnemyUnitAnimation.DicTimeline;
                ActiveUnitTimeline.AnimationMarker.Load();
            }
        }
 public override void OnDeathFrame(AnimationClass ActiveAnimation)
 {
     if (Owner != null)
     {
         Owner.DeleteCollisionBox(ListCollisionPolygon);
     }
 }
        public override void BeginDraw(CustomSpriteBatch g)
        {
            base.BeginDraw(g);

            if (ActiveCharacterSprite != null && ActiveCharacterSprite.IsAnimated)
            {
                ActiveCharacterSprite.ActiveAnimation.BeginDraw(g);
            }

            for (int L = 0; L < ListAnimationLayer.Count; L++)
            {
                if (ListAnimationLayer[L].renderTarget.Width != GraphicsDevice.PresentationParameters.BackBufferWidth ||
                    ListAnimationLayer[L].renderTarget.Height != GraphicsDevice.PresentationParameters.BackBufferHeight)
                {
                    ListAnimationLayer[L].renderTarget = new RenderTarget2D(
                        GraphicsDevice,
                        GraphicsDevice.PresentationParameters.BackBufferWidth,
                        GraphicsDevice.PresentationParameters.BackBufferHeight);
                }

                for (int M = 0; M < ListAnimationLayer[L].ListActiveMarker.Count; M++)
                {
                    AnimationClass ActiveMarkerAnimation = ListAnimationLayer[L].ListActiveMarker[M].AnimationMarker;

                    for (int i = 0; i < ActiveMarkerAnimation.ListAnimationLayer.Count; i++)
                    {
                        if (ActiveMarkerAnimation.ListAnimationLayer[i].renderTarget == null ||
                            ActiveMarkerAnimation.ListAnimationLayer[i].renderTarget.Width != GraphicsDevice.PresentationParameters.BackBufferWidth ||
                            ActiveMarkerAnimation.ListAnimationLayer[i].renderTarget.Height != GraphicsDevice.PresentationParameters.BackBufferHeight)
                        {
                            ActiveMarkerAnimation.ListAnimationLayer[i].renderTarget = new RenderTarget2D(
                                GraphicsDevice,
                                GraphicsDevice.PresentationParameters.BackBufferWidth,
                                GraphicsDevice.PresentationParameters.BackBufferHeight);
                        }
                    }
                }

                for (int M = 0; M < ListAnimationLayer[L].ListActiveMarker.Count; M++)
                {
                    AnimationClass ActiveMarkerAnimation = ListAnimationLayer[L].ListActiveMarker[M].AnimationMarker;

                    for (int i = 0; i < ActiveMarkerAnimation.ListAnimationLayer.BasicLayerCount; i++)
                    {
                        GraphicsDevice.SetRenderTarget(ActiveMarkerAnimation.ListAnimationLayer[i].renderTarget);
                        GraphicsDevice.Clear(Color.Transparent);
                        //Don't draw submarkers.
                        DrawLayer(g, ActiveMarkerAnimation.ListAnimationLayer[i], false, false, null, true);
                    }
                }

                GraphicsDevice.SetRenderTarget(ListAnimationLayer[L].renderTarget);
                GraphicsDevice.Clear(Color.Transparent);

                DrawLayer(g, ListAnimationLayer[L], false, true, null, true);
            }
        }
Beispiel #6
0
        public void LoadContent(ContentManager content)
        {
            IdleAnimate     = new AnimationClass();
            FramesPerSecond = 17;

            //Animaties
            addAnimation(Game1.Gretatextures[0], "walk", 1, 28, IdleAnimate.Copy());
            addAnimation(Game1.Gretatextures[1], "idle", 1, 12, IdleAnimate.Copy());
            addAnimation(Game1.Gretatextures[2], "smash", 1, 24, IdleAnimate.Copy());
            addAnimation(Game1.Gretatextures[3], "jump", 1, 10, IdleAnimate.Copy());

            position = new Vector2(3700, 600);
        }
Beispiel #7
0
        public void LoadContent(ContentManager content)
        {
            //animaties inladen
            IdleAnimate     = new AnimationClass();
            FramesPerSecond = 17;

            addAnimation(Game1.Hanstextures[0], "idle", 1, 11, IdleAnimate.Copy());
            addAnimation(Game1.Hanstextures[1], "walk", 1, 14, IdleAnimate.Copy());
            addAnimation(Game1.Hanstextures[2], "jump", 1, 6, IdleAnimate.Copy());

            position      = new Vector2(3700, 600);
            spriteEffects = SpriteEffects.FlipHorizontally;
        }
Beispiel #8
0
        private void setupAnimation()
        {
            // the size of each tile
            setSize(3, 11);             // must be explicitly set for tile sheets

            AnimationClass anima = new AnimationClass();

            addAnimation("laser", 0, 10, anima.copy());

            frameLength = .8f;
            animation   = "laser";
            frameIndex  = 0;
        }
Beispiel #9
0
        protected override void initialize(float scaleAnimation = 1.0f, int size = 16)
        {
            // the size of each tile
            setSize(size, size);             // must be explicitly set for tile sheets

            AnimationClass anima = new AnimationClass();

            anima.scale = scaleAnimation;
            addAnimation(Explosion.BigFireball1, 0, 8, anima.copy());
            addAnimation(Explosion.BigFireball2, 1, 8, anima.copy());


            frameLength = .05f;
        }
Beispiel #10
0
        public override void SpawnItem(AnimationClass ActiveAnimation, AnimationClass.AnimationLayer ActiveLayer, int KeyFrame)
        {
            for (int C = ListCollisionPolygon.Count - 1; C >= 0; --C)
            {
                for (int V = 0; V < ListCollisionPolygon[C].VertexCount; V++)
                {
                    ListCollisionPolygon[C].ArrayVertex[V] = ListOriginalPolygon[C].ArrayVertex[V];
                }

                ListCollisionPolygon[C].ComputerCenter();
            }

            base.SpawnItem(ActiveAnimation, ActiveLayer, KeyFrame);
        }
Beispiel #11
0
        /// <summary>
        /// Loads sprite animation.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="row"></param>
        /// <param name="frameCount"></param>
        /// <param name="anima"></param>
        public virtual void addAnimation(string name, int row, int frameCount,
                                         AnimationClass anima)
        {
            Rectangle[] recs = new Rectangle[frameCount];

            for (int i = 0; i < frameCount; i++)
            {
                recs[i] = new Rectangle(i + i * width,
                                        row + (row) * height, width, height);
            }

            anima.frameCount = frameCount;
            anima.frames     = recs;
            animations.Add(name, anima);
        }
Beispiel #12
0
        public override void addAnimation(string name, int row, int frameCount,
                                          AnimationClass anima)
        {
            Rectangle[] recs = new Rectangle[frameCount];

            for (int i = 0; i < frameCount; i++)
            {
                recs[i] = new Rectangle(i * width,
                                        row * height, width, height);
            }
            anima.rotation   = (float)Math.PI / 4;
            anima.frameCount = frameCount;
            anima.frames     = recs;
            animations.Add(name, anima);
        }
Beispiel #13
0
        public AnimateSprite(Texture2D tex, Vector2 pos, int frames, int animations)
        {
            texture = tex;
            //position = pos;
            velocity = Vector2.Zero;

            anime              = new AnimationClass();
            animation          = new SpriteAnimation(texture, frames, animations);
            animation.Position = pos;
            animation.AddAnimation("normal", 1, frames, anime.Copy());
            animation.Animation = "normal";
            bounds = animation.Bounds;
            origin = new Vector2(animation.width / 2, animation.height / 2);
            //bounds = new Rectangle((int)position.X, (int)position.Y, animation.width,animation.height);
        }
Beispiel #14
0
        public override List <VisibleTimeline> CreateNewEditorItem(AnimationClass ActiveAnimation, AnimationClass.AnimationLayer ActiveLayer, int KeyFrame, System.Drawing.Point MousePosition)
        {
            List <VisibleTimeline> ReturnValue = new List <VisibleTimeline>();

            ChargeAttackTimeline NewDamageTimeline = new ChargeAttackTimeline(Owner);

            NewDamageTimeline.Position   = new Vector2(535, 170);
            NewDamageTimeline.SpawnFrame = KeyFrame;
            NewDamageTimeline.DeathFrame = KeyFrame + 10;
            NewDamageTimeline.IsUsed     = true;//Disable the spawner as we spawn the Timeline manually.
            NewDamageTimeline.Add(KeyFrame, new VisibleAnimationObjectKeyFrame(new Vector2(NewDamageTimeline.Position.X, NewDamageTimeline.Position.Y),
                                                                               true, -1));

            ReturnValue.Add(NewDamageTimeline);

            return(ReturnValue);
        }
Beispiel #15
0
        /// <summary>
        ///
        /// </summary>
        /// <returns>Timelines by Key Frames</returns>
        public override Dictionary <int, Timeline> GetExtraTimelines(AnimationClass NewAnimation)
        {
            Vector2   OriginalPosition = SharedParams.OwnerPosition;
            Rectangle EnemyBounds      = GetEnemyPosition(NewAnimation);

            MagicProjectileSandboxEndAnimation AnimationEndSanbox = new MagicProjectileSandboxEndAnimation(EnemyBounds);

            SharedParams.OwnerPosition = OriginalPosition;
            SharedParams.OwnerAngle    = 0;
            List <Projectile> ListProjectileAfterStartAnimationEnded;
            Attack            SpellAttack = GetAnimationStartSandbox(Owner, OriginalPosition, out ListProjectileAfterStartAnimationEnded);

            foreach (Projectile ActiveProjectile in ListProjectileAfterStartAnimationEnded)
            {
                AnimationEndSanbox.AddProjectile(ActiveProjectile);
            }

            Dictionary <int, Timeline> DicExtraTimeline = new Dictionary <int, Timeline>();

            GlobalContext.OwnerSandbox = AnimationEndSanbox;
            SharedParams.OwnerPosition = Vector2.Zero;
            SharedParams.OwnerAngle    = 0;

            AnimationEndSanbox.SimulateAttack(SpellAttack);

            Owner = new MagicSpell(Owner, Owner.GlobalContext.ActiveTarget);
            MagicTimeline NewTimeline = new MagicTimeline(Owner, GlobalContext, SharedParams);

            SharedParams.OwnerPosition = OriginalPosition;
            SharedParams.OwnerAngle    = 0;
            GetAnimationStartSandbox(Owner, OriginalPosition, out ListProjectileAfterStartAnimationEnded);

            foreach (Projectile ActiveProjectile in ListProjectileAfterStartAnimationEnded)
            {
                NewTimeline.AddProjectile(ActiveProjectile);
            }

            NewTimeline.DeathFrame = AnimationEndSanbox.TotalSimulationFrames;
            NewAnimation.LoopEnd   = Math.Max(NewAnimation.LoopEnd, NewTimeline.DeathFrame);
            DicExtraTimeline.Add(0, NewTimeline);

            SharedParams.OwnerPosition = OriginalPosition;
            SharedParams.OwnerAngle    = 0;

            return(DicExtraTimeline);
        }
        public override List <VisibleTimeline> CreateNewEditorItem(AnimationClass ActiveAnimation, AnimationClass.AnimationLayer ActiveLayer, int KeyFrame, System.Drawing.Point MousePosition)
        {
            List <VisibleTimeline> ReturnValue = new List <VisibleTimeline>();

            Vector2[] LocalPoints = new Vector2[4]
            {
                new Vector2(MousePosition.X - 40, MousePosition.Y - 40),
                new Vector2(MousePosition.X - 40, MousePosition.Y + 40),
                new Vector2(MousePosition.X + 40, MousePosition.Y + 40),
                new Vector2(MousePosition.X + 40, MousePosition.Y - 40),
            };

            List <Polygon>       ListPolygon             = new List <Polygon>();
            CollisionBoxTimeline NewCollisionBoxTimeline = new CollisionBoxTimeline();
            PolygonCutterHelper  NewSpawner = new PolygonCutterHelper(ActiveLayer.renderTarget, ListPolygon, true);

            Polygon NewPolygon = new Polygon(LocalPoints, GameScreen.GraphicsDevice.Viewport.Width, GameScreen.GraphicsDevice.Viewport.Height);

            NewSpawner.PolygonCutterViewer.ListPolygon.Add(NewPolygon);

            if (NewSpawner.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                NewCollisionBoxTimeline.SpawnFrame = KeyFrame;
                NewCollisionBoxTimeline.DeathFrame = KeyFrame + 10;
                NewCollisionBoxTimeline.IsUsed     = true;//Disable the spawner as we spawn the Marker manually.

                Vector2[] NewArrayVertex = new Vector2[NewSpawner.PolygonCutterViewer.ListPolygon[0].ArrayVertex.Length];
                Array.Copy(NewSpawner.PolygonCutterViewer.ListPolygon[0].ArrayVertex, NewArrayVertex, NewSpawner.PolygonCutterViewer.ListPolygon[0].ArrayVertex.Length);

                VisibleAnimationObjectKeyFrame NewPolygonCutterKeyFrame = new VisibleAnimationObjectKeyFrame(NewCollisionBoxTimeline.Position,
                                                                                                             true, -1);

                Polygon NewKeyFramePolygon = new Polygon(NewArrayVertex, ActiveLayer.renderTarget.Width, ActiveLayer.renderTarget.Height);

                NewCollisionBoxTimeline.Add(KeyFrame, NewPolygonCutterKeyFrame);
                NewCollisionBoxTimeline.ListCollisionPolygon.Add(NewKeyFramePolygon);
                NewCollisionBoxTimeline.ListOriginalPolygon.Add(new Polygon(NewKeyFramePolygon));
                NewKeyFramePolygon.UpdateWorldPosition(Vector2.Zero, 0f);

                NewCollisionBoxTimeline.ComputeSourceRectangle();
                ReturnValue.Add(NewCollisionBoxTimeline);
            }

            return(ReturnValue);
        }
Beispiel #17
0
        public override void Load()
        {
            BackgroundRight = Content.Load <Texture2D>("Animations/Background Sprites/AW/Countryside road");
            BackgroundLeft  = Content.Load <Texture2D>("Animations/Background Sprites/AW/Countryside road");

            int ActiveUnitHP            = (int)Math.Ceiling(ActiveUnit.HP / 10d);
            int ActiveUnitHPAfterDamage = (int)Math.Ceiling((ActiveUnit.HP - DamageTakenSelf) / 10d);
            int EnemyUnitHP             = (int)Math.Ceiling(EnemyUnit.HP / 10d);
            int EnemyUnitHPAfterDamage  = (int)Math.Ceiling((EnemyUnit.HP - DamageTakenEnemy) / 10d);

            ActiveUnitAnimation = new AnimationScreen("Conquest/" + ActiveUnit.ArmourType + "/Attack by HP/" + ActiveUnitHP + " HP", ActiveUnit, ActiveTerrain, HorizontalMirror);
            ActiveUnitAnimation.Load();
            ActiveUnitAnimation.UpdateKeyFrame(0);

            AnimationScreen ActiveUnitAnimationAfterDamage = new AnimationScreen("Conquest/" + ActiveUnit.ArmourType + "/Idle by HP/" + Math.Max(0, ActiveUnitHPAfterDamage) + " HP", ActiveUnit, ActiveTerrain, HorizontalMirror);

            ActiveUnitAnimationAfterDamage.Load();
            ActiveUnitAnimationAfterDamage.UpdateKeyFrame(0);

            AnimationClass ActiveUnitAnimationDeath = new AnimationScreen("Conquest/" + ActiveUnit.ArmourType.ToString() + "/Death", ActiveUnit, ActiveTerrain, HorizontalMirror);

            ActiveUnitAnimationDeath.Load();
            ActiveUnitAnimationDeath.UpdateKeyFrame(0);

            EnemyUnitAnimation = new AnimationScreen("Conquest/" + ActiveUnit.ArmourType + "/Idle by HP/" + EnemyUnitHP + " HP", EnemyUnit, ActiveTerrain, !HorizontalMirror);
            EnemyUnitAnimation.Load();
            EnemyUnitAnimation.UpdateKeyFrame(0);

            //Todo, load Idle or Attacking animation depending of the situaton
            AnimationScreen EnemyUnitAnimationAfterDamage = new AnimationScreen("Conquest/" + ActiveUnit.ArmourType + "/Idle by HP/" + Math.Max(0, EnemyUnitHPAfterDamage) + " HP", EnemyUnit, ActiveTerrain, !HorizontalMirror);

            EnemyUnitAnimationAfterDamage.Load();
            EnemyUnitAnimationAfterDamage.UpdateKeyFrame(0);

            AnimationClass EnemyUnitAnimationDeath = new AnimationClass("Conquest/" + EnemyUnit.ArmourType.ToString() + "/Death");

            EnemyUnitAnimationDeath.DicTimeline = EnemyUnitAnimation.DicTimeline;
            EnemyUnitAnimationDeath.Load();

            InitBattleAnimation(EnemyUnitAnimation, EnemyUnitAnimationAfterDamage, "Conquest/" + EnemyUnit.ArmourType.ToString() + "/Death");

            InitBattleAnimation(ActiveUnitAnimation, ActiveUnitAnimationAfterDamage, "Conquest/" + ActiveUnit.ArmourType.ToString() + "/Death");
        }
Beispiel #18
0
        public Shield(Texture2D tex, Vector2 pos)
            : base(tex, pos)
        {
            // the size of each tile
            setSize(128, 128);             // must be explicitly set for tile sheets

            AnimationClass anima = new AnimationClass();

            //anima.scale = 1.0f;
            addAnimation("row 0", 0, 10, anima.copy());
            addAnimation("row 1", 1, 10, anima.copy());
            addAnimation("row 2", 2, 10, anima.copy());
            addAnimation("row 3", 3, 10, anima.copy());
            addAnimation("row 4", 4, 10, anima.copy());
            addAnimation("row 5", 5, 10, anima.copy());

            frameLength = .02f;
            animation   = "row 0";
            frameIndex  = 0;
        }
Beispiel #19
0
        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager theContentManager, string theAssetName)
        {
            base.LoadContent(theContentManager, theAssetName);

            boundingTexture = theContentManager.Load <Texture2D>("bounding_texture");

            AnimationClass anim = new AnimationClass();

            anim.Colour = Colour;

            AddAnimation("LeftIdle", 1, 4, anim.Copy());
            AddAnimation("Left", 2, 8, anim.Copy());
            AddAnimation("LeftJump", 3, 9, anim.Copy());

            anim.SpriteEffect = SpriteEffects.FlipHorizontally;

            AddAnimation("RightIdle", 1, 4, anim.Copy());
            AddAnimation("Right", 2, 8, anim.Copy());
            AddAnimation("RightJump", 3, 9, anim.Copy());

            Animation = "RightIdle";
        }
Beispiel #20
0
        private Rectangle GetEnemyPosition(AnimationClass NewAnimation)
        {
            float MinX = float.MaxValue;
            float MinY = float.MaxValue;
            float MaxX = float.MinValue;
            float MaxY = float.MinValue;

            Vector2        MarkerPosition       = NewAnimation.ListAnimationLayer[0].ListActiveMarker[0].Position;
            Vector2        MarkerOriginPosition = NewAnimation.ListAnimationLayer[0].ListActiveMarker[0].AnimationMarker.AnimationOrigin.Position;
            AnimationClass EnemyAnimation       = NewAnimation.ListAnimationLayer[0].ListActiveMarker[0].AnimationMarker;

            foreach (VisibleTimeline ActiveObject in EnemyAnimation.ListAnimationLayer[0].ListVisibleObject)
            {
                if (ActiveObject.Position.X < MinX)
                {
                    MinX = ActiveObject.Position.X;
                }
                if (ActiveObject.Position.X + ActiveObject.Width > MaxX)
                {
                    MaxX = ActiveObject.Position.X + ActiveObject.Width;
                }

                if (ActiveObject.Position.Y < MinY)
                {
                    MinY = ActiveObject.Position.Y;
                }
                if (ActiveObject.Position.Y + ActiveObject.Height > MaxY)
                {
                    MaxY = ActiveObject.Position.Y + ActiveObject.Height;
                }
            }

            float FinalX = MinX - MarkerOriginPosition.X + MarkerPosition.X;
            float FinalY = MinY - MarkerOriginPosition.Y + MarkerPosition.Y;

            return(new Rectangle((int)FinalX, (int)FinalY, (int)(MaxX - MinX), (int)(MaxY - MinY)));
        }
Beispiel #21
0
 public MagicTimelineEndHitAnimation(AnimationClass Owner, MagicSpell ActiveSpell, ProjectileContext GlobalContext, SharedProjectileParams SharedParams)
     : base(ActiveSpell, GlobalContext, SharedParams)
 {
     this.Owner = Owner;
 }
        public override void BeginDraw(CustomSpriteBatch g)
        {
            g.BeginUnscaled(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            GraphicsDevice.Clear(Color.Black);

            base.BeginDraw(g);

            g.End();

            if (ActiveCharacterSprite != null && ActiveCharacterSprite.IsAnimated)
            {
                ActiveCharacterSprite.ActiveAnimation.BeginDraw(g);
            }

            for (int L = 0; L < ListAnimationLayer.BasicLayerCount; L++)
            {
                if (ListAnimationLayer[L].renderTarget.Width != ScreenWidth ||
                    ListAnimationLayer[L].renderTarget.Height != ScreenHeight)
                {
                    ListAnimationLayer[L].renderTarget = new RenderTarget2D(
                        GraphicsDevice,
                        ScreenWidth,
                        ScreenHeight);
                }

                for (int M = 0; M < ListAnimationLayer[L].ListActiveMarker.Count; M++)
                {
                    AnimationClass ActiveMarkerAnimation = ListAnimationLayer[L].ListActiveMarker[M].AnimationMarker;

                    for (int i = 0; i < ActiveMarkerAnimation.ListAnimationLayer.Count; i++)
                    {
                        if (ActiveMarkerAnimation.ListAnimationLayer[i].renderTarget == null ||
                            ActiveMarkerAnimation.ListAnimationLayer[i].renderTarget.Width != ScreenWidth ||
                            ActiveMarkerAnimation.ListAnimationLayer[i].renderTarget.Height != ScreenHeight)
                        {
                            ActiveMarkerAnimation.ListAnimationLayer[i].renderTarget = new RenderTarget2D(
                                GraphicsDevice,
                                ScreenWidth,
                                ScreenHeight);
                        }
                    }
                }

                for (int M = 0; M < ListAnimationLayer[L].ListActiveMarker.Count; M++)
                {
                    AnimationClass ActiveMarkerAnimation = ListAnimationLayer[L].ListActiveMarker[M].AnimationMarker;

                    for (int i = 0; i < ActiveMarkerAnimation.ListAnimationLayer.BasicLayerCount; i++)
                    {
                        GraphicsDevice.SetRenderTarget(ActiveMarkerAnimation.ListAnimationLayer[i].renderTarget);
                        GraphicsDevice.Clear(Color.Transparent);
                        //Draw submarkers.
                        DrawLayer(g, ActiveMarkerAnimation.ListAnimationLayer[i], true, false, null, true);
                    }
                }

                GraphicsDevice.SetRenderTarget(ListAnimationLayer[L].renderTarget);
                GraphicsDevice.Clear(Color.Transparent);

                DrawLayer(g, ListAnimationLayer[L], false, true, null, true);
            }
        }
Beispiel #23
0
        public TestLevel(Texture2D texture, string mapname, Vector2 position)
        {
            this.mapname  = mapname;
            this.position = position;

            switch (mapname)
            {
            case "map":
                map = new int[, ]
                {
                    /*items*/
                    // 1 = blok      // 3 = ladder  // 5 = item // 7 = schuif obj // 9 = falldoor button // 11
                    // 2 = steen     // 4 = button  // 6 = door // 8 = fall door // 10 = pressure plate

                    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 1, 0, 1, 0, 1, 0, 3, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                    { 1, 1, 1, 1, 0, 0, 0, 0, 0, 10, 0, 10, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 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 1 },
                    { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 4, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
                    { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
                    { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
                };
                break;
            }

            buttons      = new List <Door_button>();
            ladders      = new List <Ladder>();
            stones       = new List <Steen>();
            Tiles        = new List <blok>();
            collectibles = new List <CollectItem>();
            doors        = new List <Door>();
            moveObjects  = new List <MoveObject>();
            Mdoors       = new List <MoveDoor>();
            Mbuttons     = new List <MoveDoorButton>();
            plates       = new List <PressurePlate>();

            CheckRtiles = new List <blok>();
            CheckLtiles = new List <blok>();
            CheckBtiles = new List <blok>();


            this.tiletexture = texture;

            buttonIndex = 0;
            ladderIndex = 0;
            doorIndex   = 0;


            center       = new Vector2(this.Width / 2 * 44, this.Heigth / 2 * 44);
            SpawnNextlvl = false;


            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Heigth; y++)
                {
                    //Assets in het Grid genereren
                    int textureIndex = map[y, x];
                    if (textureIndex == 0)
                    {
                        continue;
                    }
                    switch (textureIndex)
                    {
                    case 1:
                        blok tile = new blok(tiletexture, new Vector2(position.X + x * 44, position.Y + y * 44));
                        Tiles.Add(tile);
                        break;

                    case 2:
                        Steen          steen   = new Steen(Game1.crushstone, 13, 1);
                        AnimationClass animate = new AnimationClass();
                        steen.position = new Vector2(position.X + x * 44, position.Y + y * 44);
                        steen.addAnimation(Game1.crushstone, "idle", 1, 13, animate.Copy());
                        steen.Animation = "idle";

                        stones.Add(steen);
                        break;

                    case 3:
                        Ladder ladder = new Ladder(Game1.laddertextures[ladderIndex], new Vector2(position.X + x * 44, position.Y + y * 44));
                        ladderIndex++;
                        ladders.Add(ladder);
                        break;

                    case 4:
                        Door_button    button   = new Door_button(Game1.button_tex, 12, 1, buttonIndex);
                        AnimationClass animate2 = new AnimationClass();
                        button.position = new Vector2(position.X + x * 44, position.Y + y * 44);
                        button.addAnimation(Game1.button_tex, "idle", 1, 12, animate2.Copy());
                        button.Animation = "idle";
                        buttonIndex++;
                        buttons.Add(button);
                        break;

                    case 5:
                        CollectItem    item     = new CollectItem(Game1.slaktex, 50, 1);
                        AnimationClass animate3 = new AnimationClass();
                        item.position = new Vector2(position.X + x * 44, position.Y + y * 44);
                        item.addAnimation(Game1.slaktex, "idle", 1, 50, animate3.Copy());
                        item.Animation = "idle";
                        collectibles.Add(item);
                        break;

                    case 6:
                        Door door = new Door(Game1.door_tex, new Vector2(position.X + x * 44, position.Y + y * 44), doorIndex);
                        doorIndex++;
                        doors.Add(door);
                        break;

                    case 7:
                        MoveObject     obj      = new MoveObject(Game1.stonetex, 15, 1);
                        AnimationClass animate5 = new AnimationClass();
                        obj.position = new Vector2(position.X + x * 44, position.Y + y * 44);
                        obj.addAnimation(Game1.stonetex, "idle2", 1, 15, animate5.Copy());
                        obj.Animation = "idle2";
                        moveObjects.Add(obj);
                        break;

                    case 8:
                        MoveDoor objdoor = new MoveDoor(Game1.fallStone, new Vector2(position.X + x * 44, position.Y + y * 44), moveDoorIndex);
                        moveDoorIndex++;
                        Mdoors.Add(objdoor);
                        break;

                    case 9:
                        MoveDoorButton button2  = new MoveDoorButton(Game1.button_tex, 12, 1, moveButtonIndex);
                        AnimationClass animate6 = new AnimationClass();
                        button2.position = new Vector2(position.X + x * 44, position.Y + y * 44);
                        button2.addAnimation(Game1.button_tex, "idle", 1, 12, animate6.Copy());
                        button2.Animation = "idle";
                        moveButtonIndex++;
                        Mbuttons.Add(button2);
                        break;

                    case 10:
                        PressurePlate plate = new PressurePlate(Game1.pressureplate, new Vector2(position.X + x * 44, position.Y + y * 55));
                        plates.Add(plate);
                        break;

                    case 11:
                        liftobject = new LiftObject(Game1.liftobj, new Vector2(position.X + x * 44, position.Y + y * 44));
                        break;
                    }
                }
            }
        }
        public override List <VisibleTimeline> CreateNewEditorItem(AnimationClass ActiveAnimation, AnimationClass.AnimationLayer ActiveLayer, int KeyFrame, System.Drawing.Point MousePosition)
        {
            List <VisibleTimeline> ReturnValue = new List <VisibleTimeline>();

            return(ReturnValue);
        }
Beispiel #25
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="AnimationType"></param>
 /// <returns>Timelines by Key Frames</returns>
 public virtual Dictionary <int, Timeline> GetExtraTimelines(AnimationClass NewAnimation)
 {
     return(new Dictionary <int, Timeline>());
 }