public override void OnMapChange() { base.OnMapChange(); for (var index = 0; index < Cannons.Count; index++) { MannedCannon c = Cannons[index]; c.Map = Map; } for (var index = 0; index < Crew.Count; index++) { BaseCreature c = Crew[index]; if (c != null && !c.Deleted) { c.Map = Map; } } foreach (BaseCreature c in Spawn.Keys) { if (c != null && !c.Deleted) { c.Map = Map; } } if (Beacon != null) { Beacon.Map = Map; } }
public override void OnLocationChange(Point3D old) { base.OnLocationChange(old); for (var index = 0; index < Cannons.Count; index++) { MannedCannon c = Cannons[index]; c.Location = new Point3D(X + (c.X - old.X), Y + (c.Y - old.Y), Z + (c.Z - old.Z)); } for (var index = 0; index < Crew.Count; index++) { BaseCreature c = Crew[index]; c.Location = new Point3D(X + (c.X - old.X), Y + (c.Y - old.Y), Z + (c.Z - old.Z)); } foreach (BaseCreature c in Spawn.Keys) { if (c != null && !c.Deleted) { c.Location = new Point3D(X + (c.X - old.X), Y + (c.Y - old.Y), Z + (c.Z - old.Z)); } } if (Beacon != null) { Beacon.Location = new Point3D(X + (Beacon.X - old.X), Y + (Beacon.Y - old.Y), Z + (Beacon.Z - old.Z)); } }
public void OnTick() { if (_CheckSpawn) { if (BaseCreature.IsSoulboundEnemies && Spawn != null) { foreach (BaseCreature bc in Spawn.Keys) { if (!bc.Deleted) { bc.IsSoulBound = true; } } } _CheckSpawn = false; } Map map = Map; if (map == null) { return; } if (!InitialSpawn) { for (int i = 0; i < MaxSpawn; i++) { SpawnHelper(true); InitialSpawn = true; } } else if (CannonsOperational && NextShoot < DateTime.UtcNow) { for (var index = 0; index < Cannons.Count; index++) { MannedCannon c = Cannons[index]; if (c != null && !c.Deleted && (c.CanFireUnmanned || c.Operator != null && !c.Operator.Deleted && c.Operator.Alive)) { c.Scan(true); } } NextShoot = DateTime.UtcNow + TimeSpan.FromSeconds(2); } if (NextSpawn < DateTime.UtcNow) { Timer.DelayCall(TimeSpan.FromSeconds(1), () => { if (SpawnCount() < MaxSpawn) { SpawnHelper(false); } }); } }
public override void Delete() { base.Delete(); if (Beacon != null && !Beacon.Deleted) { Beacon.Delete(); } for (var index = 0; index < Crew.Count; index++) { BaseCreature bc = Crew[index]; if (bc != null && !bc.Deleted) { bc.Kill(); } } foreach (BaseCreature sp in Spawn.Keys) { if (sp != null && !sp.Deleted) { sp.Kill(); } } for (var index = 0; index < Cannons.Count; index++) { MannedCannon cannon = Cannons[index]; cannon.Delete(); } if (PlunderBeaconSpawner.Spawner != null) { PlunderBeaconSpawner.Spawner.RemovePlunderBeacon(this); } }