diff --git a/TouchyTickets/Attractions/Attraction.cs b/TouchyTickets/Attractions/Attraction.cs index a696685..647c9fb 100644 --- a/TouchyTickets/Attractions/Attraction.cs +++ b/TouchyTickets/Attractions/Attraction.cs @@ -25,6 +25,7 @@ namespace TouchyTickets.Attractions { public readonly AttractionType Type; [DataMember] private float ticketPercentage; + private float animationSizeModifier; public Attraction(AttractionType type) { this.Type = type; @@ -39,10 +40,23 @@ namespace TouchyTickets.Attractions { GameImpl.Instance.Tickets += total; this.ticketPercentage -= total; } + + // animation stuff + if (this.animationSizeModifier > 0) + this.animationSizeModifier = Math.Max(this.animationSizeModifier - 0.2F, 0); + // return the generation rate per second return genRate; } + public void Draw(SpriteBatch batch, Vector2 position, float alpha, float scale) { + var drawScale = scale; + if (this.animationSizeModifier > 0) + drawScale += (float) Math.Sin(this.animationSizeModifier) * 0.05F; + var center = this.Type.TextureRegion.Size.ToVector2() / 2; + batch.Draw(this.Type.TextureRegion, position + center * scale, Color.White * alpha, 0, center, drawScale, SpriteEffects.None, 0); + } + public float GetGenerationRate(ParkMap map, Point position) { var genRate = this.Type.GetGenerationRate(); @@ -84,6 +98,10 @@ namespace TouchyTickets.Attractions { return (long) Math.Ceiling(modifier.InitialPrice * Math.Pow(1 + 0.4F, amount)); } + public void Wobble() { + this.animationSizeModifier = MathHelper.Pi; + } + private IEnumerable GetSurrounding(ParkMap map, Point position, AttractionType type) { foreach (var tile in this.Type.GetCoveredTiles()) { foreach (var dir in Direction2Helper.Adjacent) { diff --git a/TouchyTickets/ParkMap.cs b/TouchyTickets/ParkMap.cs index d18ef4c..707b23d 100644 --- a/TouchyTickets/ParkMap.cs +++ b/TouchyTickets/ParkMap.cs @@ -158,7 +158,7 @@ namespace TouchyTickets { foreach (var offset in attraction.Type.GetCoveredTiles()) batch.Draw(batch.GetBlankTexture(), new RectangleF(position + (pos + offset).ToVector2() * tileSize, tileSize), color * 0.25F * alpha); } - batch.Draw(attraction.Type.TextureRegion, position + pos.ToVector2() * tileSize, Color.White * alpha, 0, Vector2.Zero, scale, SpriteEffects.None, 0); + attraction.Draw(batch, position + pos.ToVector2() * tileSize, alpha, scale); } // placing attraction if (this.PlacingAttraction != null) { @@ -166,7 +166,7 @@ namespace TouchyTickets { var color = this.CanPlace(this.PlacingPosition, this.PlacingAttraction) ? Color.Yellow : Color.Red; foreach (var pos in this.PlacingAttraction.Type.GetCoveredTiles()) batch.Draw(batch.GetBlankTexture(), new RectangleF(placingPos + pos.ToVector2() * tileSize, tileSize), color * 0.25F * alpha); - batch.Draw(this.PlacingAttraction.Type.TextureRegion, placingPos, Color.White * alpha * 0.5F, 0, Vector2.Zero, scale, SpriteEffects.None, 0); + this.PlacingAttraction.Draw(batch, placingPos, alpha * 0.5F, scale); } } diff --git a/TouchyTickets/Ui.cs b/TouchyTickets/Ui.cs index ec6c430..a948649 100644 --- a/TouchyTickets/Ui.cs +++ b/TouchyTickets/Ui.cs @@ -166,6 +166,7 @@ namespace TouchyTickets { GameImpl.Instance.Platform.AddResourceEvent(true, "Tickets", price, "Attraction", attraction.Key); map.Place(map.PlacingPosition, map.PlacingAttraction); + map.PlacingAttraction.Wobble(); this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name)); }, OnUpdated = (e2, time) => ((Button) e2).IsDisabled = !map.CanPlace(map.PlacingPosition, map.PlacingAttraction) @@ -233,6 +234,7 @@ namespace TouchyTickets { GameImpl.Instance.Platform.AddResourceEvent(true, "Tickets", price, "Modifier", modifier.Name); attraction.ApplyModifier(map.PlacingModifier); + attraction.Wobble(); }, OnUpdated = (e2, time) => { var disabled = map.SelectedPosition == null;