protected virtual void DrawWeaponBase(DrawParams dparams, GsRectangle bounds, GsRectangle inside) { var wbase = ImageProvider.GetFramedImage("towerBase").Image; var wbaseSize = ImageProvider.GetSize(wbase); var scale = Calculator.ComputeScale(wbaseSize, bounds.Size); var color = new GsColor(GsColor.Gray, 128); var graphics = dparams.Graphics; graphics.DrawImage(wbase, color, bounds.Location, scale); }
public void Update(TimeSpan elapsed) { // if we're not alive, then don't call this if (State != InvaderState.Alive) { return; } // if our life is 0, then we're dead if (CurrentLife <= 0) { State = InvaderState.Dead; } // if we're alive, then update if (State == InvaderState.Alive) { // compute the velocity factor given the current cell that we're on AdjustVelocityFactor(); // if we have no target cell, but we have a current cell if (TargetCell == null && CurrentCell != null) { // then move off of it MoveOffCurrentCell(elapsed); } else { // otherwise, move to the target cell MoveToTargetCell(elapsed); } // scale the seconds per frame float factor = SecondsPerFrame * (Flying ? 1.5f : 1f); // update the animation mTotalElapsedSeconds += (float)(elapsed.TotalSeconds); if (mTotalElapsedSeconds >= factor) { mTotalElapsedSeconds -= factor; mIndex = (mIndex + 1) % (ImageProvider.GetFramedImage(ImageKey).NumberFrames); } } // if we're not alive, then report back in if (State != InvaderState.Alive) { Parent.ReportBackIn(this); } }
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); }
/// <summary></summary> protected virtual GsVector[] GetImageHull() { return(ImageProvider.GetFramedImage(ImageKey).Hull); }
/// <summary></summary> public virtual GsImage GetImage() { return(ImageProvider.GetFramedImage(ImageKey).Image); }