Exemplo n.º 1
0
    public static void newScore(SeedListener.PlantSeeds plant, int addScore)
    {
        switch (plant)
        {
        case SeedListener.PlantSeeds.Beet:
            BeetScore += addScore;
            break;

        case SeedListener.PlantSeeds.Cabbage:
            CabbageScore += addScore;
            break;

        case SeedListener.PlantSeeds.Tomato:
            TomatoScore += addScore;
            break;

        default:
            unknownPlantScore += addScore;
            break;
        }

        displayScore();
        //wenn nicht alle max auf 0 sind und alle scores erreicht sind
        if (!(BeetMaxScore == 0 & TomatoMaxScore == 0 & CabbageMaxScore == 0) &
            (BeetScore >= BeetMaxScore & TomatoScore >= TomatoMaxScore & CabbageScore >= CabbageMaxScore))
        {
            ChallengeManager.challengeAccomplished();
        }
    }
Exemplo n.º 2
0
    public void Planting()
    {
        if (bedMode == BedFSM.plain)
        {
            Weeding();

            kindOfPlant = SeedListener.getCurrentPlant();

            switch (kindOfPlant)
            {
            case SeedListener.PlantSeeds.Beet:
                _myPlant = Instantiate(plantprefabs[0], transform.position + new Vector3(0, 0.1f, 0), Quaternion.identity,
                                       this.transform);
                _myPlant.transform.localScale = new Vector3(1f, 1f, 1f);
                break;

            case SeedListener.PlantSeeds.Tomato:
                _myPlant = Instantiate(plantprefabs[1], transform.position + new Vector3(0, 0.1f, 0), Quaternion.identity,
                                       this.transform);
                _myPlant.transform.localScale = new Vector3(1f, 1f, 1f);
                break;

            case SeedListener.PlantSeeds.Cabbage:
                _myPlant = Instantiate(plantprefabs[2], transform.position + new Vector3(0, 0.1f, 0), Quaternion.identity,
                                       this.transform);
                _myPlant.transform.localScale = new Vector3(1f, 1f, 1f);
                break;
            }
            _myPlant.begin(kindOfPlant);


            // if bed is wet and we plant something plant instantly grows
            if (watered)
            {
                _myPlant.Water();
            }
        }
    }
Exemplo n.º 3
0
 public void begin(SeedListener.PlantSeeds kind)
 {
     kindOfPlant = kind;
 }