Ejemplo n.º 1
0
        public WorldInstance GetPlayerWorld(WorldInstance parent)
        {
            if (parent.Entities.Any(x => x.PlayerControlled))
            {
                return(parent);
            }

            foreach (WorldInstance world in parent.Areas.Values)
            {
                return(GetPlayerWorld(world));
            }

            return(null);
        }
Ejemplo n.º 2
0
        public List <WorldInstance> GetWorlds(WorldInstance parent)
        {
            List <WorldInstance> worlds = new List <WorldInstance>();

            worlds.Add(parent);
            for (int i = 0; i < worlds.Count; i++)
            {
                foreach (WorldInstance world in worlds[i].m_Areas.Values)
                {
                    List <WorldInstance> newWorlds = GetWorlds(world);
                    for (int j = 0; j < newWorlds.Count; j++)
                    {
                        if (!worlds.Contains(newWorlds[j]))
                        {
                            worlds.Add(newWorlds[j]);
                        }
                    }
                }
            }

            return(worlds);
        }
Ejemplo n.º 3
0
 public void AddArea(Vector2Int key, WorldInstance value)
 {
     value.Parent = this;
     m_Areas.Add(key, value);
 }