Esempio n. 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);
        }
Esempio n. 2
0
        private Attack GetAnimationStartSandbox(MagicSpell ActiveSpell, Vector2 AnimationOrigin, out List <Projectile> ListOutputProjectile)
        {
            MagicProjectileSandboxStartAnimation AnimationStartSandbox = new MagicProjectileSandboxStartAnimation();

            GlobalContext.OwnerSandbox = AnimationStartSandbox;
            SharedParams.OwnerPosition = AnimationOrigin;
            SharedParams.OwnerAngle    = 0;

            List <BaseAutomaticSkill> ListAttackAttribute = ActiveSpell.ComputeSpell();
            Attack SpellAttack = new Attack("Dummy Attack");

            SpellAttack.ArrayAttackAttributes = ListAttackAttribute.ToArray();

            ListOutputProjectile = AnimationStartSandbox.SimulateAttack(SpellAttack);

            foreach (Projectile ActiveProjectile in ListOutputProjectile)
            {
                float MinX = float.MaxValue;
                float MinY = float.MaxValue;
                float MaxX = float.MinValue;
                float MaxY = float.MinValue;

                for (int P = ActiveProjectile.Collision.ListCollisionPolygon.Count - 1; P >= 0; --P)
                {
                    for (int V = ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex.Length - 1; V >= 0; --V)
                    {
                        if (ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].X < MinX)
                        {
                            MinX = ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].X;
                        }
                        if (ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].X > MaxX)
                        {
                            MaxX = ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].X;
                        }

                        if (ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].Y < MinY)
                        {
                            MinY = ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].Y;
                        }
                        if (ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].Y > MaxY)
                        {
                            MaxY = ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].Y;
                        }
                    }
                }

                //Offset almost completely outside screen
                ActiveProjectile.Offset(new Vector2(Constants.Width + MaxX - 1, 0));
                ActiveProjectile.IsAlive = true;
            }

            return(SpellAttack);
        }
Esempio n. 3
0
        protected MagicProjectileSandboxStartAnimation GetAnimationStartSandbox(Vector2 AnimationOrigin)
        {
            MagicProjectileSandboxStartAnimation AnimationStartSandbox = new MagicProjectileSandboxStartAnimation();

            GlobalContext.OwnerSandbox = AnimationStartSandbox;
            SharedParams.OwnerPosition = AnimationOrigin;
            SharedParams.OwnerAngle    = 0;

            List <BaseAutomaticSkill> ListAttackAttribute = new MagicSpell(Owner, Owner.GlobalContext.ActiveTarget).ComputeSpell();
            Attack SpellAttack = new Attack();

            SpellAttack.ArrayAttackAttributes = ListAttackAttribute.ToArray();

            AnimationStartSandbox.SimulateAttack(SpellAttack);

            return(AnimationStartSandbox);
        }