converted a bunch of types to higher-bit versions
This commit is contained in:
parent
32affd77a1
commit
969496bb22
4 changed files with 17 additions and 17 deletions
|
@ -21,21 +21,21 @@ namespace TouchyTickets.Attractions {
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public readonly AttractionType Type;
|
public readonly AttractionType Type;
|
||||||
[DataMember]
|
[DataMember]
|
||||||
private float ticketPercentage;
|
private double ticketPercentage;
|
||||||
private float animationSizeModifier;
|
private float animationSizeModifier;
|
||||||
|
|
||||||
public Attraction(AttractionType type) {
|
public Attraction(AttractionType type) {
|
||||||
this.Type = type;
|
this.Type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float Update(GameTime time, TimeSpan passed, ParkMap map, Point position) {
|
public double Update(GameTime time, TimeSpan passed, ParkMap map, Point position) {
|
||||||
var genRate = this.GetGenerationRate(map, position);
|
var genRate = this.GetGenerationRate(map, position);
|
||||||
// apply generation rate to ticket amount
|
// apply generation rate to ticket amount
|
||||||
this.ticketPercentage += genRate * (float) passed.TotalSeconds;
|
this.ticketPercentage += genRate * passed.TotalSeconds;
|
||||||
var total = this.ticketPercentage.Floor();
|
var total = (BigInteger) this.ticketPercentage;
|
||||||
if (total > 0) {
|
if (total > 0) {
|
||||||
GameImpl.Instance.Tickets += total;
|
GameImpl.Instance.Tickets += total;
|
||||||
this.ticketPercentage -= total;
|
this.ticketPercentage -= (double) total;
|
||||||
}
|
}
|
||||||
|
|
||||||
// animation stuff
|
// animation stuff
|
||||||
|
@ -55,12 +55,12 @@ namespace TouchyTickets.Attractions {
|
||||||
batch.Draw(tex, position + center * scale, Color.White * alpha, 0, center, drawScale, SpriteEffects.None, 0);
|
batch.Draw(tex, position + center * scale, Color.White * alpha, 0, center, drawScale, SpriteEffects.None, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetGenerationRate(ParkMap map, Point position) {
|
public double GetGenerationRate(ParkMap map, Point position) {
|
||||||
var genRate = this.Type.GetGenerationRate();
|
var genRate = this.Type.GetGenerationRate();
|
||||||
|
|
||||||
// apply attraction modifiers
|
// apply attraction modifiers
|
||||||
foreach (var modifier in this.Modifiers)
|
foreach (var modifier in this.Modifiers)
|
||||||
genRate *= (float) Math.Pow(modifier.Modifier.Multiplier, modifier.Amount);
|
genRate *= Math.Pow(modifier.Modifier.Multiplier, modifier.Amount);
|
||||||
|
|
||||||
// apply star upgrades
|
// apply star upgrades
|
||||||
if (Upgrade.FerrisWheelModifier.IsActive() && this.GetSurrounding(map, position, FerrisWheel).Any())
|
if (Upgrade.FerrisWheelModifier.IsActive() && this.GetSurrounding(map, position, FerrisWheel).Any())
|
||||||
|
@ -91,9 +91,9 @@ namespace TouchyTickets.Attractions {
|
||||||
return this.Modifiers.Where(m => modifier == null || m.Modifier == modifier).Sum(m => m.Amount);
|
return this.Modifiers.Where(m => modifier == null || m.Modifier == modifier).Sum(m => m.Amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long GetModifierPrice(AttractionModifier modifier) {
|
public BigInteger GetModifierPrice(AttractionModifier modifier) {
|
||||||
var amount = this.GetModifierAmount(modifier);
|
var amount = this.GetModifierAmount(modifier);
|
||||||
return (long) Math.Ceiling(modifier.InitialPrice * Math.Pow(1 + 0.4F, amount));
|
return (BigInteger) Math.Ceiling(modifier.InitialPrice * Math.Pow(1 + 0.4F, amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Wobble() {
|
public void Wobble() {
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace TouchyTickets.Attractions {
|
||||||
return new Attraction(this);
|
return new Attraction(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetGenerationRate() {
|
public double GetGenerationRate() {
|
||||||
var genRate = this.generationPerSecond;
|
var genRate = this.generationPerSecond;
|
||||||
|
|
||||||
if (this.Flags.HasFlag(FastCars) && Upgrade.RollerCoasterModifier.IsActive())
|
if (this.Flags.HasFlag(FastCars) && Upgrade.RollerCoasterModifier.IsActive())
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace TouchyTickets {
|
||||||
private readonly Dictionary<Point, int> fencePositions = new Dictionary<Point, int>();
|
private readonly Dictionary<Point, int> fencePositions = new Dictionary<Point, int>();
|
||||||
private readonly Attraction[,] attractionGrid;
|
private readonly Attraction[,] attractionGrid;
|
||||||
|
|
||||||
public float TicketsPerSecond { get; private set; }
|
public double TicketsPerSecond { get; private set; }
|
||||||
public Attraction PlacingAttraction;
|
public Attraction PlacingAttraction;
|
||||||
public AttractionModifier PlacingModifier;
|
public AttractionModifier PlacingModifier;
|
||||||
public Point PlacingPosition;
|
public Point PlacingPosition;
|
||||||
|
@ -68,7 +68,7 @@ namespace TouchyTickets {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(GameTime time, TimeSpan passed) {
|
public void Update(GameTime time, TimeSpan passed) {
|
||||||
var tickets = 0F;
|
var tickets = 0D;
|
||||||
foreach (var (pos, attraction) in this.attractions) {
|
foreach (var (pos, attraction) in this.attractions) {
|
||||||
var genPerSecond = attraction.Update(time, passed, this, pos);
|
var genPerSecond = attraction.Update(time, passed, this, pos);
|
||||||
tickets += genPerSecond;
|
tickets += genPerSecond;
|
||||||
|
|
|
@ -146,7 +146,7 @@ namespace TouchyTickets {
|
||||||
IsHidden = true
|
IsHidden = true
|
||||||
};
|
};
|
||||||
foreach (var attraction in AttractionType.Attractions) {
|
foreach (var attraction in AttractionType.Attractions) {
|
||||||
long price = 0;
|
BigInteger price = 0;
|
||||||
var attractionAmount = 0;
|
var attractionAmount = 0;
|
||||||
var button = buyUi.AddChild(new Button(Anchor.AutoLeft, new Vector2(1, 40)) {
|
var button = buyUi.AddChild(new Button(Anchor.AutoLeft, new Vector2(1, 40)) {
|
||||||
ChildPadding = new Vector2(4),
|
ChildPadding = new Vector2(4),
|
||||||
|
@ -168,7 +168,7 @@ namespace TouchyTickets {
|
||||||
ActionSound = new SoundEffectInfo(Assets.PlaceSound),
|
ActionSound = new SoundEffectInfo(Assets.PlaceSound),
|
||||||
OnPressed = e2 => {
|
OnPressed = e2 => {
|
||||||
GameImpl.Instance.Tickets -= price;
|
GameImpl.Instance.Tickets -= price;
|
||||||
GameImpl.Instance.Platform.AddResourceEvent(true, "Tickets", price, "Attraction", attraction.Key);
|
GameImpl.Instance.Platform.AddResourceEvent(true, "Tickets", (long) price, "Attraction", attraction.Key);
|
||||||
|
|
||||||
map.Place(map.PlacingPosition, map.PlacingAttraction);
|
map.Place(map.PlacingPosition, map.PlacingAttraction);
|
||||||
map.PlacingAttraction.Wobble();
|
map.PlacingAttraction.Wobble();
|
||||||
|
@ -185,7 +185,7 @@ namespace TouchyTickets {
|
||||||
// only update the price when the area updates, since it won't change while we're in the buy ui
|
// only update the price when the area updates, since it won't change while we're in the buy ui
|
||||||
attractionAmount = GameImpl.Instance.Map.GetAttractionAmount(attraction.Value);
|
attractionAmount = GameImpl.Instance.Map.GetAttractionAmount(attraction.Value);
|
||||||
// yay compound interest
|
// yay compound interest
|
||||||
price = (long) Math.Ceiling(attraction.Value.InitialPrice * Math.Pow(1 + 0.1F, attractionAmount));
|
price = (BigInteger) Math.Ceiling(attraction.Value.InitialPrice * Math.Pow(1 + 0.1F, attractionAmount));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var image = button.AddChild(new Image(Anchor.CenterLeft, new Vector2(0.2F, 40), Assets.AttractionTexture[attraction.Value.TextureRegion]) {
|
var image = button.AddChild(new Image(Anchor.CenterLeft, new Vector2(0.2F, 40), Assets.AttractionTexture[attraction.Value.TextureRegion]) {
|
||||||
|
@ -249,7 +249,7 @@ namespace TouchyTickets {
|
||||||
if (GameImpl.Instance.Tickets < price)
|
if (GameImpl.Instance.Tickets < price)
|
||||||
break;
|
break;
|
||||||
GameImpl.Instance.Tickets -= price;
|
GameImpl.Instance.Tickets -= price;
|
||||||
GameImpl.Instance.Platform.AddResourceEvent(true, "Tickets", price, "Modifier", modifier.Name);
|
GameImpl.Instance.Platform.AddResourceEvent(true, "Tickets", (long)price, "Modifier", modifier.Name);
|
||||||
attraction.ApplyModifier(map.PlacingModifier);
|
attraction.ApplyModifier(map.PlacingModifier);
|
||||||
}
|
}
|
||||||
attraction.Wobble();
|
attraction.Wobble();
|
||||||
|
@ -264,7 +264,7 @@ namespace TouchyTickets {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addButton.Text.GetTextCallback = p => {
|
addButton.Text.GetTextCallback = p => {
|
||||||
var price = map.PlacingModifier.InitialPrice;
|
BigInteger price = map.PlacingModifier.InitialPrice;
|
||||||
if (map.SelectedPosition != null) {
|
if (map.SelectedPosition != null) {
|
||||||
var attraction = map.GetAttractionAt(map.SelectedPosition.Value);
|
var attraction = map.GetAttractionAt(map.SelectedPosition.Value);
|
||||||
if (attraction != null && map.PlacingModifier.IsAffected(attraction))
|
if (attraction != null && map.PlacingModifier.IsAffected(attraction))
|
||||||
|
|
Loading…
Reference in a new issue