public void Setup()
 {
     _layout = ScriptableObject.CreateInstance <WorldLayout>();
     _layout.Resize(new GridBasedSize(3, 3));
     _structure1 = ScriptableObject.CreateInstance <StructureDescriptor>();
     _structure2 = ScriptableObject.CreateInstance <StructureDescriptor>();
     _structure3 = ScriptableObject.CreateInstance <StructureDescriptor>();
 }
Exemplo n.º 2
0
 public Data()
 {
     worldLayout    = new WorldLayout(null, 0);
     terrainCells   = new List <TerrainCell>();
     overworldCells = new List <TerrainCell>();
     rivers         = new List <ProcGen.River>();
     gameSpawnData  = new GameSpawnData();
     world          = new Chunk();
     voronoiTree    = new Tree(0);
 }
        private bool IsInvalid(GameObject brushTarget, out WorldLayout mapPart)
        {
            if (brushTarget.layer == 31)
            {
                mapPart = null;
                return(true);
            }

            mapPart = brushTarget.GetComponent <WorldLayoutContainerBehavior>()?.AssociatedLayout;
            return(mapPart == null);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets the previous level in a linear level sequence.
        /// Only valid for LinearHorizontal and LinearVertical layouts.
        /// Returns null if this is the first level.
        /// </summary>
        public Level GetPreviousNeighbour(WorldLayout worldLayout)
        {
            switch (worldLayout)
            {
            case WorldLayout.LinearHorizontal:
                return(Neighbours.FirstOrDefault(level => level.IsWest));

            case WorldLayout.LinearVertical:
                return(Neighbours.FirstOrDefault(level => level.IsNorth));
            }
            Debug.LogWarning($"LDtk: Tried getting previous neighbour with an invalid world layout: {worldLayout}");
            return(null);
        }
 private ref WorldLayout.MapGridItem Get(int x, int y, WorldLayout instance = null)
 => ref (instance ?? _layout)[new GridCoordinate(x, y)];