Ejemplo n.º 1
0
        public void ExcessSow(int addCount)
        {
            if (addCount <= 0)
            {
                throw new Exception("TomatoSeed excessSow fail, addCount is " + addCount);
            }
            unexpectTomatoCount += addCount;
            var plants = new List <TomatoPlant>();

            if (state != TOMATO_SEED_STATE.Sowed ||
                state != TOMATO_SEED_STATE.Excess)
            {
                throw new Exception("TomatoSeed excessSow fail, state is " + state);
            }
            state = TOMATO_SEED_STATE.Excess;
            for (int i = 0; i < addCount; i++)
            {
                var plant = new TomatoPlant(this);
                plant.OnFinish += OnSelfPlantFinish;
                plants.Add(plant);
            }
            allPlants.AddRange(plants);

            var curPlant = SelectNextPlant();

            curPlant.StartGrow();
        }
Ejemplo n.º 2
0
        public TomatoSeed()
        {
            curGrowPlantIdx = -1;
            state           = TOMATO_SEED_STATE.Ready;
            allPlants       = new List <TomatoPlant>();

            createTime = DateTime.Now;
        }
Ejemplo n.º 3
0
 public void Finish()
 {
     if (state != TOMATO_SEED_STATE.Sowed ||
         state != TOMATO_SEED_STATE.Excess)
     {
         throw new Exception("TomatoSeed finish fail, state is " + state);
     }
     state = TOMATO_SEED_STATE.Finish;
 }
Ejemplo n.º 4
0
        public void Sow()
        {
            var plants = new List <TomatoPlant>();

            if (state != TOMATO_SEED_STATE.Ready)
            {
                throw new Exception("TomatoSeed sow fail, state is " + state);
            }
            state = TOMATO_SEED_STATE.Sowed;
            for (int i = 0; i < expectTomatoCount; i++)
            {
                var plant = new TomatoPlant(this);
                plant.OnFinish += OnSelfPlantFinish;
                plants.Add(plant);
            }
            allPlants.AddRange(plants);

            var curPlant = SelectNextPlant();

            curPlant.StartGrow();
        }