Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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());
            }
        }
Example #4
0
        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());
        }
Example #5
0
        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);
            }
        }
Example #6
0
 public static TeamId GetTeam(GameObject gameObject)
 {
     return(gameObject.getTeam());
 }
Example #7
0
        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;
        }
Example #8
0
        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());
        }
Example #9
0
        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());
            }
        }