Exemple #1
0
        public bool planting(int x, int y)
        {
            PlantsBox pb = map.Pb;

            if (pb.IsAcitive == false)
            {
                return(false);
            }
            pb.setXY(x - pb.Width / 2, y - pb.Height / 2);

            BoxForPlant bfp = MyAPI.AdjustPonint(x, y);
            Plant       p   = PlantOnLand(bfp, pb.Type);

            //Plant p = pb.Planting();
            if (p == null)
            {
                return(false);
            }
            map.SunShine -= map.SunCost;
            map.addPlant(p);
            map.Pc.loading();//装填弹药
            pb.Destroy();

            return(true);
        }
Exemple #2
0
        internal void setShadow(int p, int p_2)
        {
            BoxForPlant bfp = MyAPI.AdjustPonint(p, p_2);

            //判断指定位置是否有陆地可供种植
            if (hasLandStreet(bfp.S))
            {
                map.Pb.ShadowX = (int)bfp.S;
            }
            if (hasLandFloor(bfp.F))
            {
                map.Pb.ShadowY = (int)bfp.F;
            }
            map.Update();
        }
Exemple #3
0
        public Plant PlantOnLand(BoxForPlant bfp, string type)
        {
            Street s = bfp.S;
            Floor  f = bfp.F;

            for (int i = 0; i < map.Lands.Count; i++)
            {
                Land land = (Land)map.Lands[i];
                if (s == land.Street && f == land.Floor)
                {
                    Plant plant = land.GrowPlant(type);
                    return(plant);
                }
            }
            return(null);
        }