Example #1
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.NetId))
                //    _objects[o.NetId] = o;
                //else
                _objects.Add(o.NetId, o);
            }

            if (o is Inhibitor)
            {
                var i = o as Inhibitor;
                lock (_inhibitorsLock)
                {
                    _inhibitors.Add(i.NetId, i);
                }
            }

            _collisionHandler.AddObject(o);

            if (!(o is Unit))
            {
                return;
            }

            AddVisionUnit(o as Unit);

            if (o is Minion)
            {
                _game.PacketNotifier.NotifyMinionSpawned(o as Minion, o.Team);
            }
            else if (o is Monster)
            {
                _game.PacketNotifier.NotifySpawn(o as Monster);
            }
            else if (o is Champion)
            {
                AddChampion(o as Champion);
            }
            else if (o is Placeable)
            {
                _game.PacketNotifier.NotifySpawn(o as Placeable);
            }
            else if (o is AzirTurret)
            {
                _game.PacketNotifier.NotifySpawn(o as AzirTurret);
            }
        }
Example #2
0
    public void CreateEntity(Vector3 position, Quaternion rotation, Vector3 scale, int closestPoint)
    {
        positions.Add(position);
        rotations.Add(rotation);
        scales.Add(scale);

        Quaternion newRot = Quaternion.Euler(EulerRotationDisplacement.x, EulerRotationDisplacement.y, EulerRotationDisplacement.z);


        Quaternion trueRot   = rotation * newRot;
        Vector3    truePos   = position + trueRot * PositionDisplacement;
        Vector3    trueScale = Vector3.Scale(scale, scaleMultiplier);

        foreach (EntitySpawner e in spawners)
        {
            e.CreateArchetype(truePos, trueRot, trueScale);
        }
        collisionHandler.AddObject(this, closestPoint, truePos, trueRot, trueScale);
    }