public override void Update(GameTime gameTime) { MoveSpeed = 1f; if (Counter > FactionManager.GetFaction(ParentBox.ParentShip.FactionNumber).MiningPlatformCounter / 2) { GlowAlpha -= gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * GlowAlphaChange; FullAlpha -= gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * AlphaChange; if (FullAlpha < 0) { FullAlpha = 0; } if (GlowAlpha < 0) { GlowAlpha = 0; } } else { if (GlowAlpha == 0) { ExtraGlowAlpha = 2; } GlowAlpha += gameTime.ElapsedGameTime.Milliseconds * 60 / 10000f * GlowAlphaChange; FullAlpha += gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * AlphaChange; if (FullAlpha > 1) { FullAlpha = 1; } float MaxGlowAlpha = FactionManager.CanBuildMiningPlatform(ParentBox.ParentShip.FactionNumber) ? 2 : 1; if (GlowAlpha > MaxGlowAlpha) { GlowAlpha = MaxGlowAlpha; } } ExtraGlowAlpha -= gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * AlphaChange; if (ExtraGlowAlpha < 0) { ExtraGlowAlpha = 0; } base.Update(gameTime); }
public override void Interact(PlayerShip p) { if (miningPlatform == null && FactionManager.CanBuildMiningPlatform(p.FactionNumber)) { Vector3 P3 = new Vector3(Position.X(), 0, Position.Y()); for (int i = 0; i < 40; i++) { LineParticleSystem.AddParticle(P3, P3 + Rand.V3() * 1000, TeamInfo.GetColor(p.GetTeam())); } MiningPlatform m = FactionManager.GetMiningPlatform(p.FactionNumber); ParentLevel.AddObject(m); m.Position.set(Position.get()); setPlatform(m); SoundManager.Play3DSound("PlayerBuildMiningRing", new Vector3(m.Position.X(), Y, m.Position.Y()), 0.25f, 500, 1); if (p.PlacedStartingMineralRock) { FactionManager.AddCells(p.FactionNumber, -FactionManager.GetMiningPlatformCost(p.FactionNumber)); FactionManager.SetBuildingPlatform(p.FactionNumber, m); } else { FactionManager.GetFaction(p.FactionNumber).MiningPlatformCounter = 0; m.HullToughness *= 2; m.SetAsStarting(); p.PlacedStartingMineralRock = true; p.StartingMineralRock = this; } p.LastPlacedPlatform.AddFirst(m); PathFindingManager.AddMineralRock(m); } base.Interact(p); }
public override bool CanInteract(PlayerShip p) { return((FactionManager.CanAfford(p.FactionNumber, FactionManager.GetMiningPlatformCost(p.FactionNumber)) || !p.PlacedStartingMineralRock) && miningPlatform == null && FactionManager.CanBuildMiningPlatform(p.FactionNumber)); }