public TeslaCoilPiece() { // setup the description StringBuilder sb = new StringBuilder(); sb.AppendLine("Fires a charged burst of electricity. The burst is very effective against ground units."); // set the properties needed Attack = 9000; Price = 2500; Radius = 250; UpgradePercent = 45; LevelVisibility = 75; Description = sb.ToString(); ProjectileLifeInSeconds = 6.7f; CanFireProjectiles = false; Name = TeslaCoilName; UltimateName = UltimateTeslaCoilName; Grouping = PieceGrouping.Three; ImageKey = "teslaCoil"; Element = Element.Electricity; Specialty = PieceSpecialty.Both; // set the properties of the piece mIndex = 0; mAggregateTimeSinceUpdate = 0; mTeslaState = TeslaState.Idle; Color = GsColor.White; // get the image var image = GetImage(); var imageSize = ImageProvider.GetSize(image); FrameSize = new GsSize(imageSize.Width / (NumberIndexFrames + 1), imageSize.Height); LightningColor = GsMath.Lerp(GsColor.Purple, GsColor.DarkBlue, .5f); LightningColor = GsMath.Lerp(LightningColor, GsColor.Red, .75f); }
protected override GsVector[] GetImageHull() { return(ImageProvider.GetFramedImage(ImageKey)[mIndex].Hull); }
public override GsImage GetImage() { return(ImageProvider.GetFramedImage(ImageKey)[mIndex].Image); }
/// <summary> /// Levels up this invader by adding on the experience points. Each experience is /// distributed to a certain attribute of the invader based on the weights that /// are passed in. /// </summary> /// <param name="experiencePts">The amount of experience points.</param> /// <param name="info">The info to use when distributing the experience points.</param> public void LevelUp(float experiencePts, float level, InvaderLevelUpInfo info) { // add on to the current experience Experience += experiencePts; // from here, determine the mu float mu = Calculator.CalculatePercent(level, MinInvaderLevel, MaxInvaderLevel); // now, determine the level (make sure we're at least lvl1) Level = level; // determine the value Value = (float)Math.Ceiling(Level * 5); // calculate the maximum life MaximumLife = (float)Math.Floor(GsMath.SmoothStep(MinInvaderLife, MaxInvaderLife, mu)); // get the elements with the highest count int max = info.ElementCounts.Max(i => i.Value); Element[] elements = (from kvp in info.ElementCounts where kvp.Value.Equals(max) select kvp.Key).ToArray(); // for now, set the first one to be our element Element = elements.Length == 1 ? elements[0] : Element.None; // create a dictionary List <InvaderAttributes> attributes = mAttributes.Keys.ToList(); // based on the level, add on the to the attributes foreach (InvaderAttributes attribute in attributes) { var minmax = MinMaxValues[attribute]; mAttributes[attribute] = (float)Math.Floor(GsMath.SmoothStep(minmax.Min, minmax.Max, mu)); // TODO: // here, we need to determine if we're going to increase/decrease the defense, skill, or speed // based on how many invaders made it. // // An easy AI would take away abilities when invaders didn't // make it. It would also decrease defense and skill. Basically making it easier on the player. // // A normal AI wouldn't do anything. // A hard AI would very slightly increase the attributes // A difficult AI...you get the picture. } // set the color based on the element Color = Colors[Element]; // TODO: // here, based on the skill, we would update the abilities. // set the base image key int key = (int)Math.Floor(Level / LevelDenominator); ImageKey = BaseImageKeys[key][Flying ? 1 : 0]; // randomize the animation settings mIndex = RandomGenerator.Next() % ImageProvider.GetFramedImage(ImageKey).NumberFrames; mTotalElapsedSeconds = RandomGenerator.Next(10) * SecondsPerFrame; }
public override GsImage GetDisplayImage() { return(ImageProvider.GetFramedImage(ImageKey)[0].Image); }
public static void DrawImage(this IGsGraphics graphics, GsImage image, GsColor color, GsVector location, GsVector scale) { var size = ImageProvider.GetSize(image).ToVector() * scale; graphics.DrawImage(image, location.X, location.Y, size.X, size.Y, color); }
/// <summary></summary> protected virtual GsVector[] GetImageHull() { return(ImageProvider.GetFramedImage(ImageKey).Hull); }
/// <summary></summary> public virtual GsImage GetImage() { return(ImageProvider.GetFramedImage(ImageKey).Image); }