public void Deactivate(bool deactivate = true) { if (deactivate) { Active = false; } if (Spawns != null) { foreach (SpawnEntry entry in Spawns) { List <BaseCreature> list = new List <BaseCreature>(); foreach (BaseCreature bc in entry.Spawn) { list.Add(bc); } foreach (BaseCreature creature in list) { creature.Delete(); } ColUtility.Free(list); } Spawns.Clear(); } }
private void loadSpawnButton_Click(object sender, EventArgs e) { var dialog = new OpenFileDialog(); dialog.Filter = dialog.Filter = "Map files (*.map)|*.map"; var result = dialog.ShowDialog(); if (result == DialogResult.OK) { // Clear map if (Spawns.Count > 0) { foreach (var spawn in Spawns) { RenderObjectsManager.RemoveSpawn(spawn); } Spawns.Clear(); } var spawnReader = new SpawnReader(); spawnReader.MapFileName = dialog.FileName; var spawns = spawnReader.LoadSpawns(); Spawns = spawns; allSpawnsListBox.DataSource = Spawns; foreach (var spawn in spawns) { RenderObjectsManager.AddSpawner(spawn); } RefreshUI(); } }
protected override void sv_Despawn() { if (Spawns.Count > 0) { Spawns[0].sv_Despawn(); Spawns.Clear(); } }
protected override void sv_Despawn() { for (int i = 0; i < Spawns.Count; i++) { Spawns[i].sv_Despawn(); } Spawns.Clear(); }
/// <summary>Clears all spawn information</summary> public void Clear() { Spawns.Clear(); Target = null; Player = null; Selected = null; Highlighted = null; Update(); }
protected override void sv_Despawn() { for (var i = 0; i < Spawns.Count; i++) { Spawns[i].sv_Despawn(); } Spawns.Clear(); SpawnAmount = 0; }
protected override void sv_Despawn() { for (int i = 0; i < Spawns.Count; i++) { if (Spawns[i] != null && !Spawns[i].IsDead() && !Spawns[i].IsDespawned()) { Spawns[i].sv_Despawn(); } } Spawns.Clear(); }
public void LoadSpawns() { if (Spawns != null) { Spawns.Clear(); } Spawns = new List <SpawnEntry>(); Spawns.Add(new SpawnEntry(this, new Rectangle2D[] { new Rectangle2D(5564, 1888, 26, 31) })); Spawns.Add(new SpawnEntry(this, new Rectangle2D[] { new Rectangle2D(5554, 1888, 8, 28) })); Spawns.Add(new SpawnEntry(this, new Rectangle2D[] { new Rectangle2D(5596, 1888, 8, 28) })); Spawns.Add(new SpawnEntry(this, new Rectangle2D[] { new Rectangle2D(5536, 1876, 8, 8), new Rectangle2D(5552, 1840, 11, 42) })); Spawns.Add(new SpawnEntry(this, new Rectangle2D[] { new Rectangle2D(5600, 1860, 8, 8), new Rectangle2D(5596, 1872, 15, 12) })); Spawns.Add(new SpawnEntry(this, new Rectangle2D[] { new Rectangle2D(5608, 1832, 15, 15), new Rectangle2D(5616, 1848, 11, 34) })); Spawns.Add(new SpawnEntry(this, new Rectangle2D[] { new Rectangle2D(5568, 1852, 22, 14) }, 15)); Spawns.Add(new SpawnEntry(this, new Rectangle2D[] { new Rectangle2D(5568, 1824, 22, 11) })); Spawns.Add(new SpawnEntry(this, new Rectangle2D[] { new Rectangle2D(5501, 1800, 42, 19) }, 15)); }
private void InitForm() { if (SelectedSpawn != null) { RenderObjectsManager.RemoveSpawn(SelectedSpawn); Spawns.Remove(SelectedSpawn); } if (Spawns != null) { foreach (var spawn in Spawns) { RenderObjectsManager.RemoveSpawn(spawn); } Spawns.Clear(); } InitMobileTypes(); Spawns = new BindingList <SpawnObject>(); allSpawnsListBox.DataSource = Spawns; spawnMobilesListBox.DataSource = null; teamTextBox.Text = "0"; spawnNameTextBox.Text = "<Name>"; homeRangeTextBox.Text = "5"; minTimeTextBox.Text = "2.5"; maxTimeTextBox.Text = "10.0"; npcCountTextBox.Text = "1"; bringToHomeCheckBox.Checked = false; uniqueSpawnCheckBox.Checked = false; if (Spawns == null) { Spawns = new BindingList <SpawnObject>(); } }
public void Unload() { Spawns.Clear(); }
public override bool Update(GameTime gameTime, float percent) { var newSpawns = new List <Vector2>(); foreach (var spawn in Spawns) { if (spawn.X > Position.X) { newSpawns.Add(spawn); } else { ActiveSpawn = new Vector2(spawn.X, spawn.Y); } } Spawns.Clear(); Spawns.AddRange(newSpawns); Position = new Vector2(Position.X + Velocity.X * percent, Position.Y + Velocity.Y * percent); ActionState.UpdateHitBox(); if (BoundingBox.Dimensions.Bottom >= MarioCloneGame.LevelAreas[LevelArea].Bottom) { if (!(PowerupState is MarioDead2)) { BecomeDead(); } } else { if (Gravity) { Velocity = new Vector2(Velocity.X, Velocity.Y + GravityAcceleration * percent); } Gravity = true; } //TODO fix update to be inside the states or smth, or give mario a BecomeFall() method if (!(ActionState is MarioFall2 || ActionState is MarioDash) && Velocity.Y > 1.5) { StateMachine.TransitionFall(); } StateMachine.UpdateDash(gameTime); PowerupState.Update(gameTime); _FireBallPool.Update(gameTime); if (Position.X < 19000 && outSideBoss == false) { EventManager.Instance.TriggerEnterBossRoom(this); outSideBoss = true; } else if (Position.X > 19000 && outSideBoss == true) { EventManager.Instance.TriggerEnterBossRoom(this); outSideBoss = false; } return(base.Update(gameTime, percent)); }