internal static AnimatedColors Create(AnimatedColorsManager mngr, int durationPerColor, Color[] colors) { var def = new AnimatedColors(durationPerColor, colors); mngr.AddAnimation(def); return(def); }
//////////////// internal AnimatedColorsManager() { var mymod = ModLibsGeneralMod.Instance; this.Alert = AnimatedColors.Create(this, 16, new Color[] { Color.Yellow, Color.Gray }); this.Ember = AnimatedColors.Create(this, 16, new Color[] { Color.Orange, Color.Orange * 0.65f }); this.Strobe = AnimatedColors.Create(this, 16, new Color[] { Color.Black, Color.White }); this.Fire = AnimatedColors.Create(this, 16, new Color[] { Color.Red, Color.Yellow }); this.Water = AnimatedColors.Create(this, 16, new Color[] { Color.Blue, Color.Turquoise }); this.Air = AnimatedColors.Create(this, 16, new Color[] { Color.White, Color.Gray }); this.Ether = AnimatedColors.Create(this, 16, new Color[] { Color.MediumSpringGreen, Color.Gray }); Color green = Color.Lime; // The colors lie! Color indigo = new Color(147, 0, 255, 255); Color violet = new Color(255, 139, 255, 255); this.Disco = AnimatedColors.Create(this, 56, new Color[] { Color.Red, Color.Orange, Color.Yellow, green, Color.Blue, indigo, violet }); this.DiscoFast = AnimatedColors.Create(this, 8, new Color[] { Color.Red, Color.Orange, Color.Yellow, green, Color.Blue, indigo, violet }); if (!Main.dedServ) { this.OnTickGet = Timers.MainOnTickGet(); Main.OnTick += AnimatedColorsManager._Update; } }
//////////////// public void AddAnimation(AnimatedColors animation) { this.Defs.Add(animation); }
//////////////// /// <summary> /// Creates an animated color object. /// </summary> /// <param name="durationPerColor">Ticks of time to spend between each color.</param> /// <param name="colors">Sequence of colors to loop through.</param> /// <returns></returns> public static AnimatedColors Create(int durationPerColor, Color[] colors) { return(AnimatedColors.Create(ModContent.GetInstance <AnimatedColorsManager>(), durationPerColor, colors)); }