示例#1
0
        //Terrain instance

        public static TerrainInstance MakeTerrainInstance(this ActiveTerrainDef tDef, Map map, IntVec3 loc)
        {
            var terr = (TerrainInstance)Activator.CreateInstance(tDef.terrainInstanceClass);

            terr.def      = tDef;
            terr.Map      = map;
            terr.Position = loc;
            return(terr);
        }
 public void RegisterAt(ActiveTerrainDef special, IntVec3 cell)
 {
     if (!terrains.ContainsKey(cell))
     {
         var newTerr = special.MakeTerrainInstance(map, cell);
         newTerr.Init();
         terrainInstances.Add(newTerr);
         terrains.Add(cell, newTerr);
         this.terrainDefs.Add(special);
         FixAt(terrainInstances.Count);
     }
 }
 public void RegisterAt(ActiveTerrainDef special, int i)
 {
     RegisterAt(special, map.cellIndices.IndexToCell(i));
 }