예제 #1
0
    private bool TryHarvestPlant(SoilBin bin)
    {
        Seed seed = bin.Harvest();

        if (seed != null)
        {
            HarvestedFullyGrownPlant(seed);
            return(true);
        }

        return(false);
    }
예제 #2
0
    protected override bool MeetCriteria(SoilBin bin)
    {
        if (bin.CanAddWater() &&
            bin.PercentFull <= waterThreshold &&
            !bin.IsGettingWateredSoon &&
            !bin.CanHarvest())
        {
            bin.IsGettingWateredSoon = true;
            return(true);
        }

        return(false);
    }
예제 #3
0
    private bool TryPlantSeed(SoilBin bin)
    {
        if (bin.CanPlantSeed())
        {
            Seed seed = UseSeedFromInventory();
            if (seed != null)
            {
                bin.PlantSeed(seed);
                return(true);
            }
        }

        return(false);
    }
예제 #4
0
파일: Map.cs 프로젝트: nsparisi/n3-games
    public List <SoilBin> GetAdjacentBins(int x, int y)
    {
        //check up down left right
        GameObject[] adjacentTiles = new GameObject[4];
        adjacentTiles[0] = GetTileGameObject(x, y + 1);
        adjacentTiles[1] = GetTileGameObject(x, y - 1);
        adjacentTiles[2] = GetTileGameObject(x - 1, y);
        adjacentTiles[3] = GetTileGameObject(x + 1, y);

        //find bins
        List <SoilBin> adjacentBins = new List <SoilBin>();

        for (int i = 0; i < adjacentTiles.Length; i++)
        {
            SoilBin bin = TryGetBin(adjacentTiles[i]);
            if (bin != null)
            {
                adjacentBins.Add(bin);
            }
        }

        return(adjacentBins);
    }
예제 #5
0
 private bool TryWaterSeed(SoilBin bin)
 {
     bin.FillWithWater();
     return(true);
 }
예제 #6
0
 protected abstract bool MeetCriteria(SoilBin bin);
예제 #7
0
 protected override bool MeetCriteria(SoilBin bin)
 {
     return(false);
 }
예제 #8
0
 protected override bool MeetCriteria(SoilBin bin)
 {
     return(bin.CanHarvest());
 }
예제 #9
0
파일: Seed.cs 프로젝트: nsparisi/n3-games
 public void AddToBin(SoilBin bin)
 {
     this.bin = bin;
 }
예제 #10
0
 protected override bool MeetCriteria(SoilBin bin)
 {
     return(bin.CanPlantSeed());
 }