public bool TeamHasVisionOn(TeamId team, GameObject o) { if (o == null) { return(false); } if (o.getTeam() == team) { return(true); } lock (_objectsLock) { foreach (var kv in _objects) {//TODO: enable mesh as soon as it works again if (kv.Value.getTeam() == team && kv.Value.distanceWith(o) < kv.Value.getVisionRadius() /*&& !mesh.isAnythingBetween(kv.Value, o)*/) { var unit = kv.Value as Unit; if (unit != null && unit.isDead()) { continue; } return(true); } } } return(false); }
public bool teamHasVisionOn(TeamId team, GameObject o) { if (o == null) { return(false); } if (o.getTeam() == team) { return(true); } lock (objects) { foreach (var kv in objects) { if (kv.Value.getTeam() == team || (kv.Value.distanceWith(o) < kv.Value.getVisionRadius() && !mesh.isAnythingBetween(kv.Value, o))) { var unit = kv.Value as Unit; if (unit == null || unit.isDead()) { continue; } return(true); } } } return(false); }
public void addObject(GameObject o) { if (o == null) { return; } lock (objects) objects.Add(o.getNetId(), o); var u = o as Unit; if (u == null) { return; } collisionHandler.addObject(o); var team = o.getTeam(); var teamVision = visionUnits[Convert.fromTeamId(team)]; if (teamVision.ContainsKey(o.getNetId())) { teamVision[o.getNetId()] = u; } else { teamVision.Add(o.getNetId(), u); } var m = u as Minion; if (m != null) { PacketNotifier.notifyMinionSpawned(m, m.getTeam()); } var mo = u as Monster; if (mo != null) { PacketNotifier.notifySpawn(mo); } var c = o as Champion; if (c != null) { champions[c.getNetId()] = c; PacketNotifier.notifyChampionSpawned(c, c.getTeam()); } }
public void removeObject(GameObject o) { var c = o as Champion; if (c != null) { champions.Remove(c.getNetId()); } lock (objects) objects.Remove(o.getNetId()); visionUnits[Convert.fromTeamId(o.getTeam())].Remove(o.getNetId()); }
public void AddObject(GameObject o) { if (o == null) { return; } // If it crashes here the problem is most likely somewhere else lock (_objectsLock) { // (_objects.ContainsKey(o.getNetId())) // _objects[o.getNetId()] = o; //else _objects.Add(o.getNetId(), o); } _collisionHandler.addObject(o); if (!(o is Unit)) { return; } AddVisionUnit(o as Unit); if (o is Minion) { _game.PacketNotifier.notifyMinionSpawned(o as Minion, o.getTeam()); } else if (o is Monster) { _game.PacketNotifier.notifySpawn(o as Monster); } else if (o is Champion) { AddChampion(o as Champion); } }
public static TeamId GetTeam(GameObject gameObject) { return(gameObject.getTeam()); }
public bool teamHasVisionOn(TeamId team, GameObject o) { if (o == null) return false; if (o.getTeam() == team) return true; lock (objects) { foreach (var kv in objects) { if (kv.Value.getTeam() == team || (kv.Value.distanceWith(o) < kv.Value.getVisionRadius() && !mesh.isAnythingBetween(kv.Value, o))) { var unit = kv.Value as Unit; if (unit == null || unit.isDead()) continue; return true; } } } return false; }
public void removeObject(GameObject o) { var c = o as Champion; if (c != null) champions.Remove(c.getNetId()); lock (objects) objects.Remove(o.getNetId()); visionUnits[Convert.fromTeamId(o.getTeam())].Remove(o.getNetId()); }
public void addObject(GameObject o) { if (o == null) return; lock (objects) objects.Add(o.getNetId(), o); var u = o as Unit; if (u == null) return; collisionHandler.addObject(o); var team = o.getTeam(); var teamVision = visionUnits[Convert.fromTeamId(team)]; if (teamVision.ContainsKey(o.getNetId())) teamVision[o.getNetId()] = u; else teamVision.Add(o.getNetId(), u); var m = u as Minion; if (m != null) PacketNotifier.notifyMinionSpawned(m, m.getTeam()); var mo = u as Monster; if (mo != null) PacketNotifier.notifySpawn(mo); var inhi = u as Inhibitor; if (inhi != null) PacketNotifier.notifySpawn(inhi); var c = o as Champion; if (c != null) { champions[c.getNetId()] = c; PacketNotifier.notifyChampionSpawned(c, c.getTeam()); } }