示例#1
0
文件: Room.cs 项目: akbiggs/Trauma
        private void AddAllBuffered()
        {
            foreach (GameObject obj in toAdd)
            {
                if (obj is Player)
                {
                    player = (Player)obj;
                    Section curSection = GetDeepestSection(player);
                    float zoomLevel = curSection == null ? DEFAULT_ZOOM : curSection.ZoomLevel;
                    camera = new Camera(player, width, height, zoomLevel);
                    miniMap.Mappings.Add(obj, ResourceManager.GetTexture("Player_Icon"));
                }
                else if (obj is Portal)
                {
                    portals.Add((Portal)obj);
                    if (toAdd.FindAll((_obj) => _obj is Portal).Count == 1)
                    {
                        CorrectPortal = (Portal)obj;
                        miniMap.Mappings.Add(obj, ResourceManager.GetTexture("Portal_Icon"));
                    }
                    else if ((toAdd.Find((_obj) => _obj is Portal && ((Portal)_obj).IsCorrect) != null))
                    {
                        if (!((Portal)obj).IsCorrect)
                            miniMap.Mappings.Add(obj, ResourceManager.GetTexture("Portal_Icon"));
                        else
                            CorrectPortal = (Portal)obj;
                    }
                    else
                        throw new InvalidOperationException("Multiple portals but no correct portal specified.");

                }
                else if (obj is InkGenerator)
                {
                    generators.Add((InkGenerator)obj);
                    miniMap.Mappings.Add(obj, ResourceManager.GetTexture("Generator_Icon"));
                }
                else if (obj is InkBlob)
                    blobs.Add((InkBlob)obj);
                else if (obj is WaveGenerator)
                    waveGenerators.Add((WaveGenerator)obj);
                else if (obj is Wave)
                    waves.Add((Wave)obj);
                else if (obj is SpoutGenerator)
                    spoutGenerators.Add((SpoutGenerator)obj);
                else if (obj is Spout)
                    spouts.Add((Spout)obj);
                else if (obj is Barrier)
                    barriers.Add((Barrier)obj);
            }

            toAdd.Clear();
        }
示例#2
0
文件: Room.cs 项目: akbiggs/Trauma
        private void RemoveAllBuffered()
        {
            foreach (GameObject obj in toRemove)
            {
                if (obj is Player)
                    player = null;
                else if (obj is Portal)
                    portals.Remove((Portal)obj);
                else if (obj is InkGenerator)
                    generators.Remove((InkGenerator)obj);
                else if (obj is InkBlob)
                    blobs.Remove((InkBlob)obj);
                else if (obj is WaveGenerator)
                    waveGenerators.Remove((WaveGenerator)obj);
                else if (obj is Wave)
                    waves.Remove((Wave)obj);
                else if (obj is SpoutGenerator)
                    spoutGenerators.Remove((SpoutGenerator)obj);
                else if (obj is Spout)
                    spouts.Remove((Spout)obj);
                else if (obj is Barrier)
                    barriers.Remove((Barrier)obj);
            }

            toRemove.Clear();
        }