static public SortedList CreateColourTween(ColourShift Shift, int Time, int FrameLength) { if (FrameLength <= 0) { FrameLength = 1; } if (Time < 0) { Time = 0; } SortedList Construct = new SortedList(); if (Time == 0) { Construct.Add(0, Shift); } else { Construct.Add(0, new ColourShift(0, 0, 0, 0)); for (int i = FrameLength; i <= Time; i += FrameLength) { Construct.Add(i, new ColourShift(Shift.R / ((float)Time / (float)FrameLength), Shift.G / ((float)Time / (float)FrameLength), Shift.B / ((float)Time / (float)FrameLength), Shift.A / ((float)Time / (float)FrameLength))); } } return(Construct); }
public override void Update() { Color R = TextEntity.GetRainbowColour(); float Fade = (pColour.A / 255f); pColour = new ColourShift(((R.R * 0.4f) + (255f * 0.6f)) * Fade, ((R.G * 0.4f) + (255f * 0.6f)) * Fade, ((R.B * 0.4f) + (255f * 0.6f)) * Fade, pColour.A); base.Update(); }
object GetItemAt(int Time, SortedList Frames) { Vector2 OutVector = new Vector2(); float OutFloat = 0f; ColourShift OutColour = new ColourShift(0, 0, 0, 0); int OutMode = -1; if (Frames.Count > 0) { cSpent = false; } int[] K = new int[Frames.Count]; Frames.Keys.CopyTo(K, 0); foreach (int T in K) { if (T <= Time) { if (Frames[T] is Vector2) { OutVector += (Vector2)Frames[T]; OutMode = 0; } else if (Frames[T] is float) { OutFloat += (float)Frames[T]; OutMode = 1; } else if (Frames[T] is ColourShift) { OutColour += (ColourShift)Frames[T]; OutMode = 2; } Frames.Remove(T); } } object Out = null; switch (OutMode) { case 0: Out = OutVector; break; case 1: Out = OutFloat; break; case 2: Out = OutColour; break; } return(Out); }
public RuneGlow(String Name, Vector2 Location, TAtlasInfo?Atlas, float Depth) : base(Name, Location, Atlas, Depth) { pColour = new ColourShift(0f, 0f, 0f, 0f); SpaceAdjust = Environment.TickCount % 10000; CenterOrigin = false; foreach (WorldEntity W in Shell.UpdateQueue) { if (W is RuneGlow && !(W == this)) { Nodraw = true; Shell.DeleteQueue.Add(this); } } }
public override void Update() { Color R = TextEntity.GetRainbowColour(); float Fade = pColour.A / 255f; pColour = new ColourShift(R.R * Fade, R.G * Fade, R.B * Fade, pColour.A); if (SofiaE != null) { Mirror(SofiaE); } else { FindSofia(); } base.Update(); }
public static ColourShift Constrain(ColourShift Base) { float[] Vals = new float[] { Base.R, Base.G, Base.B, Base.A }; for (int i = 0; i < 4; i++) { if (Vals[i] < 0f) { Vals[i] = 0f; } if (Vals[i] > 255f) { Vals[i] = 255f; } } return(new ColourShift(Vals[0], Vals[1], Vals[2], Vals[3])); }
public override void Update() { pColour = new ColourShift(255f, 255f, 255f, 255f) * (float)((-Math.Cos(GetMySinable) / 2d) + 0.5); base.Update(); }