Esempio n. 1
0
    private static List <Flower> LoadFlowers(PlantDatabase data)
    {
        List <Flower> flowers = new List <Flower>();

        if (File.Exists(flowerPath))
        {
            using (StreamReader sr = new StreamReader(flowerPath)) {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    //Debug.Log("Load Flower: " + line);
                    flowers.Add(new Flower(data, line));
                    Inventory.NumberOfFlower++;
                }
            }
        }
        if (flowers.Count == 0)
        {
            flowers.Add(new Flower(data, data.Scavenge()));
            flowers.Add(new Flower(data, data.Scavenge()));
            flowers.Add(new Flower(data, data.Scavenge()));
            Inventory.NumberOfFlower += 3;
        }

        Debug.Log(flowers.Count);
        return(flowers);
    }
Esempio n. 2
0
 //Scavenged Flower Constructor
 public Flower(PlantDatabase data)
 {
     this.creationTime = DateTime.Now;
     this.data         = data;
     this.genes        = data.Scavenge();
 }