public override void Update(GameTime gameTime) { frame.WorldMatrix = WorldMatrix; if (UnitCount > 0 && !Dead && WaveFSM.WaveStepState.WeaponsFree) { UnitDelay += gameTime.ElapsedGameTime.Milliseconds; if (UnitDelay > MaxUnitDelay) { UnitCount--; UnitDelay -= MaxUnitDelay; UnitShip s = (UnitShip)SpawnCard.GetUnit(FactionNumber); ParentLevel.AddObject(s); s.SetLevel((IsUpdgraded ? 3 : 2) * WaveManager.DifficultyMult, 1); if (GetTeam() == WaveManager.ActiveTeam) { float Theta = 0; float Offset = 0; Vector3 Position3 = new Vector3(Position.X(), Y, Position.Y()); while (!TestFree(Position.get(), Theta, Offset, Size.X())) { Theta += (float)Math.PI / 10f; if (Theta > Math.PI * 2) { Theta -= (float)Math.PI * 2; Offset += Size.X() / 2; } } Vector2 BestPosition = Position.get() + Logic.ToVector2(Theta) * Offset; s.Position.set(BestPosition); Position3 = new Vector3(BestPosition.X, 0, BestPosition.Y); for (int j = 0; j < 30; j++) { ParticleManager.CreateParticle(Position3, Rand.V3() * 200, new Color(1, 0.75f, 0.5f), 20, 5); } Position3 = new Vector3(Position.X(), 0, Position.Y()); ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.75f, 0.5f), Size.X() * 5, 4); for (int i = 0; i < 30; i++) { ParticleManager.CreateParticle(Position3, Rand.V3() * 200, new Color(1, 0.75f, 0.5f), 20, 5); } } else { s.Position.set(NeutralManager.GetSpawnPosition()); } } } base.Update(gameTime); }
public static void NewWave(SceneObject Scene) { CurrentWave++; WaveMessage = "Wave " + CurrentWave.ToString(); WaveAlpha = 1; FactionManager.NewWave(Scene); NeutralManager.NewWave(); }
public override void Update(GameTime gameTime) { /* * SparkTimer += gameTime.ElapsedGameTime.Milliseconds; * if (SparkTimer > MaxSparkTimer.get()) * { * SparkTimer -= MaxSparkTimer.get(); * ParentLevel.AddObject(new PathfindingFlare(PathFindingManager.self, Rand.r.Next(PathFindingManager.self.CellsX.get()), * Rand.r.Next(PathFindingManager.self.CellsX.get()), 0, 0, Color.getAsColor())); * }*/ if (!WaveFSM.WaveStepState.WeaponsFree) { Basic2DScene Parent2DScene = (Basic2DScene)ParentScene; Vector2 p = NeutralManager.GetSpawnPosition(); ParentLevel.AddObject(new PathfindingFlare(PathFindingManager.self, (int)((p.X - Parent2DScene.MinBoundary.X()) / PathFindingManager.self.Divisor.X), (int)((p.Y - Parent2DScene.MinBoundary.Y()) / PathFindingManager.self.Divisor.Y), 0, 0, Color.getAsColor())); } base.Update(gameTime); }
public void buildAttackGrid() { if (AttackGrid == null) { AttackGrid = new int[CellsX.get(), CellsY.get()]; } AttackJobQue.Clear(); for (int x = 0; x < CellsX.get(); x++) { for (int y = 0; y < CellsY.get(); y++) { AttackGrid[x, y] = NeutralCell; } } MiningPlatform forwardPlatform = PathFindingManager.TraceToMiningPlatform(NeutralManager.GetSpawnPosition(), WaveManager.ActiveTeam); foreach (MiningPlatform r in Parent2DScene.Enumerate(typeof(MiningPlatform))) { if (!r.Dead && r.GetTeam() == WaveManager.ActiveTeam) { Vector2 UpperLeftCorner = (r.getUpperLeftCorner() - Parent2DScene.MinBoundary.get()) / Divisor; Vector2 LowerRightCorner = (r.getLowerRightCorner() - Parent2DScene.MinBoundary.get()) / Divisor; int MinX = (int)UpperLeftCorner.X; int MinY = (int)UpperLeftCorner.Y; int MaxX = (int)LowerRightCorner.X; int MaxY = (int)LowerRightCorner.Y; for (int x = MinX; x < MaxX; x++) { for (int y = MinY; y < MaxY; y++) { AttackJobQue.Enqueue(x); AttackJobQue.Enqueue(y); AttackJobQue.Enqueue(r == forwardPlatform && WaveManager.CurrentWave > 5 ? StartingCell / 2 : StartingCell); } } } } foreach (UnitTurret u in Parent2DScene.Enumerate(typeof(UnitTurret))) { if (!u.Dead && u.GetTeam() == WaveManager.ActiveTeam && ((u.MyCard == null && !NeutralManager.MyPattern.CurrentCard.Type.Equals("Heavy")) || (u.MyCard != null && !u.MyCard.StrongVs.Equals(NeutralManager.MyPattern.CurrentCard.Type)))) { Vector2 UpperLeftCorner = (u.getUpperLeftCorner() - Parent2DScene.MinBoundary.get()) / Divisor; Vector2 LowerRightCorner = (u.getLowerRightCorner() - Parent2DScene.MinBoundary.get()) / Divisor; int MinX = (int)UpperLeftCorner.X; int MinY = (int)UpperLeftCorner.Y; int MaxX = (int)LowerRightCorner.X; int MaxY = (int)LowerRightCorner.Y; for (int x = MinX; x < MaxX; x++) { for (int y = MinY; y < MaxY; y++) { AttackJobQue.Enqueue(x); AttackJobQue.Enqueue(y); AttackJobQue.Enqueue(StartingCell); } } } } }
public static void NewEvent(SceneObject Scene) { FactionManager.NewWaveEvent(Scene); NeutralManager.NewWaveEvent(); }
public static void EndWave() { NeutralManager.EndWave(); }