コード例 #1
0
 public override void Update()
 {
     if (Shell.Rnd.Next(0, 2) == 0 && !Cease)
     {
         Shell.RunQueue.Add(new VoidDel(delegate()
         {
             UpwardParticle Add = new UpwardParticle("PURPLESPRITE", new Vector2(Shell.Rnd.Next(140, 1140), Shell.Rnd.Next(200, 600)), (TAtlasInfo)Shell.AtlasDirectory["PURPLE"], 0.4f);
             Add.CenterOrigin   = true;
             Add.ColourValue    = new Color(0, 0, 0, 0);
             Add.AnimationQueue.Add(Animation.Retrieve("FADEINOUT"));
             Add.TransientAnimation = true;
             Shell.UpdateQueue.Add(Add);
             Shell.RenderQueue.Add(Add);
         }));
     }
     LastFireCountdown--;
     if (LastFireCountdown < 1)
     {
         LastFireCountdown = 1;
     }
     if (Shell.Rnd.Next(0, LastFireCountdown) == 0 && !Cease)
     {
         LastFireCountdown = 400;
         Shell.RunQueue.Add(new VoidDel(delegate()
         {
             Double Degree      = Shell.Rnd.NextDouble() * (2 * Math.PI);
             Vector2 SpawnPos   = (new Vector2((float)Math.Sin(Degree), (float)Math.Cos(Degree)) * 1000f) + new Vector2(640, 360);
             Transient Add      = new Transient("MEME", SpawnPos, (TAtlasInfo)Shell.AtlasDirectory["MEMES"], ((float)Shell.Rnd.NextDouble() * 0.09f) + 0.405f);
             Add.CenterOrigin   = true;
             Vector2 Target     = new Vector2(Shell.Rnd.Next(400, 881), Shell.Rnd.Next(300, 420));
             Vector2 Trajectory = (Target - Add.DrawCoords) * 2;
             Animation A        = new Animation("MEMEFLOATER");
             Animation B        = new Animation("MEMEFLOATER_TURN");
             SortedList Moves   = Animation.CreateVectorTween(Trajectory, 7000, 33);
             A.WriteMovement(Moves);
             SortedList Rots = Animation.CreateFloatTween(Shell.Rnd.Next(-10, 10) / 10f, 1000, 33);
             B.WriteRotation(Rots);
             A.Loop = true;
             B.Loop = true;
             Add.AnimationQueue.Add(A);
             Add.AnimationQueue.Add(B);
             Add.SetAtlasFrame(new Point(Shell.Rnd.Next(0, 4), Shell.Rnd.Next(0, 4)));
             Add.Scale(new Vector2(-0.5f, -0.5f));
             Shell.UpdateQueue.Add(Add);
             Shell.RenderQueue.Add(Add);
         }));
     }
     base.Update();
 }
コード例 #2
0
            public override void Update()
            {
                base.Update();
                if (Shell.DeleteQueue.Contains(this))
                {
                    foreach (WorldEntity E in Dependents)
                    {
                        Shell.DeleteQueue.Add(E);
                    }
                }
                ArrayList CleanupR = new ArrayList();

                foreach (WorldEntity D in Dependents)
                {
                    if (!(Shell.UpdateQueue.Contains(D) || Shell.RenderQueue.Contains(D)))
                    {
                        CleanupR.Add(D);
                    }
                }
                foreach (WorldEntity C in CleanupR)
                {
                    Dependents.Remove(C);
                }
                CleanupR = new ArrayList();
                int LocalTimeElapsed = Environment.TickCount - LastTime;

                if (ButtonScripts.Paused)
                {
                    LocalTimeElapsed = 0;
                }
                MyTime += LocalTimeElapsed;
                if (ButtonScripts.Paused)
                {
                    LastTime = Environment.TickCount;
                    return;
                }
                if (MyTime > 300000000)
                {
                    MyTime = 0;
                }
                if (States.Contains("FLOATING"))
                {
                    if (AdjustSin == -100d)
                    {
                        AdjustSin = (MyTime / 1000f) - (Math.Floor((MyTime / 1000f) / (Math.PI * 2)) * (Math.PI * 2));
                    }
                    Move(new Vector2(0, (float)(Math.Sin(MyTime / 1000f - AdjustSin) - Math.Sin((MyTime / 1000f - AdjustSin) - 60)) * 0.75f));
                }
                if (States.Contains("GLOW"))
                {
                    if (MyMask == null)
                    {
                        MyMask = new EssenseGlow("BIGSOFIA_CHILD_ESSENCEGLOW", pDrawCoords + new Vector2(35, 100), (TAtlasInfo)Shell.AtlasDirectory["BIGJUDGINGGLOW"], LayerDepth + 0.1f, Name);
                        Dependents.Add(MyMask);
                        Shell.RunQueue.Add(new VoidDel(delegate()
                        {
                            Shell.UpdateQueue.Add(MyMask);
                            Shell.RenderQueue.Add(MyMask);
                        }
                                                       ));
                    }
                    else
                    {
                        MyMask.QuickMoveTo(pDrawCoords + new Vector2(35, 100));
                    }
                }
                else if (MyMask != null)
                {
                    Shell.DeleteQueue.Add(MyMask);
                    MyMask = null;
                }
                if (States.Contains("SHIFTER"))
                {
                    if (Shell.Rnd.Next(0, 20) == 0)
                    {
                        int AY = Shell.Rnd.Next(0, 3);
                        int AX = Shell.Rnd.Next(0, 4);
                        if (AY == 2)
                        {
                            AX = Shell.Rnd.Next(0, 2);
                        }
                        pAtlasCoordinates = new Point(AX, AY);
                        if (MyMask != null && pAtlasCoordinates != new Point(0, 0))
                        {
                            MyMask.Drawable = false;
                        }
                        else if (MyMask != null)
                        {
                            MyMask.Drawable = true;
                        }
                    }
                }
                else
                {
                    if (MyMask != null)
                    {
                        MyMask.Drawable = true;
                    }
                }
                if (States.Contains("SPEW1"))
                {
                    if (MyTime % SpewFreqencyOne < 1000)
                    {
                        SetForSpew1 = true;
                        if (Shell.Rnd.Next(0, 2) == 1)
                        {
                            SpewVar1.X = 1;
                        }
                        else
                        {
                            SpewVar1.X = -1;
                        }
                        if (Shell.Rnd.Next(0, 2) == 1)
                        {
                            SpewVar1.Y = 1;
                        }
                        else
                        {
                            SpewVar1.Y = -1;
                        }
                    }
                    if (SetForSpew1 && (MyTime % SpewFreqencyOne) - 1000 > 0)
                    {
                        if (SpewCounter1 < Math.Floor(((MyTime % SpewFreqencyOne) - 1000) / 50f) + 1)
                        {
                            Transient Add = new Transient("BIGSOFIA_CHILD_SPEW", pDrawCoords + new Vector2(0, -80), (TAtlasInfo)Shell.AtlasDirectory["BIGSOFIA"], LayerDepth - 0.1f + (0.001f * SpewCounter1));
                            Dependents.Add(Add);
                            Add.Lifespan     = 1500;
                            Add.CenterOrigin = true;
                            double     SinNum     = ((Math.PI / 6d) * SpewCounter1);
                            Vector2    Trajectory = new Vector2((float)Math.Sin(SinNum) * 1000f * SpewVar1.X, (float)Math.Cos(SinNum) * 1000f * SpewVar1.Y);
                            Animation  A          = new Animation("BIGSOFIASPEW");
                            Animation  B          = new Animation("BIGSOFIASPEW_TURN");
                            SortedList Moves      = Animation.CreateVectorTween(Trajectory, 1000, 20);
                            A.WriteMovement(Moves);
                            SortedList Rots = Animation.CreateFloatTween(Shell.Rnd.Next(-10, 10) / 10f, 2000, 20);
                            B.WriteRotation(Rots);
                            A.Loop = true;
                            B.Loop = true;
                            Add.AnimationQueue.Add(A);
                            Add.AnimationQueue.Add(B);
                            int AY = Shell.Rnd.Next(0, 3);
                            int AX = Shell.Rnd.Next(0, 4);
                            if (AY == 2)
                            {
                                AX = Shell.Rnd.Next(0, 2);
                                if (Shell.Rnd.Next(0, 20) == 0)
                                {
                                    AX = 2;
                                }
                            }
                            Add.SetAtlasFrame(new Point(AX, AY));
                            Add.Scale(new Vector2(-0.6f, -0.6f));

                            Shell.RunQueue.Add(new VoidDel(delegate()
                            {
                                Shell.UpdateQueue.Add(Add);
                                Shell.RenderQueue.Add(Add);
                            }));
                            SpewCounter1++;
                            if (SpewCounter1 >= 12)
                            {
                                SpewCounter1 = 0;
                                SetForSpew1  = false;
                            }
                        }
                    }
                }
                else
                {
                    SetForSpew1 = false;
                }
                if (States.Contains("SPEW2"))
                {
                    if (MyTime % SpewFreqencyTwo < 1000)
                    {
                        SetForSpew2 = true;
                    }
                    if (SetForSpew2 && (MyTime % SpewFreqencyTwo) - 1000 > 0)
                    {
                        if (SpewCounter2 < Math.Floor(((MyTime % SpewFreqencyTwo) - 1000) / 300f) + 1)
                        {
                            for (int i = 0; i < 12; i++)
                            {
                                Transient Add = new Transient("BIGSOFIA_CHILD_SPEW", pDrawCoords + new Vector2(0, -70), (TAtlasInfo)Shell.AtlasDirectory["BIGSOFIA"], LayerDepth - 0.1f + (0.001f * SpewCounter1));
                                Dependents.Add(Add);
                                Add.Lifespan     = 1500;
                                Add.CenterOrigin = true;
                                double     SinNum     = ((Math.PI / 6d) * i);
                                Vector2    Trajectory = new Vector2((float)Math.Sin(SinNum) * 1000f, (float)Math.Cos(SinNum) * 1000f);
                                Animation  A          = new Animation("BIGSOFIASPEW");
                                Animation  B          = new Animation("BIGSOFIASPEW_TURN");
                                SortedList Moves      = Animation.CreateVectorTween(Trajectory, 1000, 20);
                                A.WriteMovement(Moves);
                                SortedList Rots = Animation.CreateFloatTween(Shell.Rnd.Next(-10, 10) / 10f, 2000, 20);
                                B.WriteRotation(Rots);
                                A.Loop = true;
                                B.Loop = true;
                                Add.AnimationQueue.Add(A);
                                Add.AnimationQueue.Add(B);
                                int AY = Shell.Rnd.Next(0, 3);
                                int AX = Shell.Rnd.Next(0, 4);
                                if (AY == 2)
                                {
                                    AX = Shell.Rnd.Next(0, 2);
                                    if (Shell.Rnd.Next(0, 20) == 0)
                                    {
                                        AX = 2;
                                    }
                                }
                                Add.SetAtlasFrame(new Point(AX, AY));
                                Add.Scale(new Vector2(-0.6f, -0.6f));

                                Shell.RunQueue.Add(new VoidDel(delegate()
                                {
                                    Shell.UpdateQueue.Add(Add);
                                    Shell.RenderQueue.Add(Add);
                                }));
                            }
                            SpewCounter2++;
                            if (SpewCounter2 >= SpewWavesTwo)
                            {
                                SpewCounter2 = 0;
                                SetForSpew2  = false;
                            }
                        }
                    }
                }
                else
                {
                    SetForSpew2 = false;
                }
                LastTime = Environment.TickCount;
            }