Beispiel #1
0
 public void AddRandomFurniture(string name, string furnitureDirection, int treshold)
 {
     bool[,] map = StageConstructor.createRandomMap(rct, treshold);
     for (int x = 0; x < map.GetLength(0); x++)
     {
         for (int z = 0; z < map.GetLength(1); z++)
         {
             if (map[x, z])
             {
                 addFurniture(name, new CRD(x + rct.Start.x, z + rct.Start.z), furnitureDirection);
             }
         }
     }
 }
Beispiel #2
0
        public void AddRandomFurniture(string furnitureDirection, int treshold)
        {
            int furnitureListCount = furnitureList.Count;

            if (furnitureListCount < 0)
            {
                return;
            }

            bool[,] map = StageConstructor.createRandomMap(rct, treshold);
            for (int x = 0; x < map.GetLength(0); x++)
            {
                for (int z = 0; z < map.GetLength(1); z++)
                {
                    if (map[x, z])
                    {
                        float  rand  = Random.Range(0, furnitureListCount * 100) / 100;
                        int    index = Mathf.RoundToInt(rand);
                        string name  = furnitureList[index];
                        addFurniture(name, new CRD(x + rct.Start.x, z + rct.Start.z), furnitureDirection);
                    }
                }
            }
        }