Пример #1
0
    public void Grow()
    {
        if (_health != HealthStates.Dry)
        {
            switch (_age)
            {
            case PlantStates.Seeds:
                _age = PlantStates.Young;
                seedsPrefab.SetActive(false);
                youngPrefab.SetActive(true);
                break;

            case PlantStates.Young:
                _age = PlantStates.Adult;
                youngPrefab.SetActive(false);
                adultPrefab.SetActive(true);
                break;

            default:
                break;
            }
        }
        _health = HealthStates.Dry;
        wateredPlot.SetActive(false);
        overWateredPlot.SetActive(false);
        drownedPlot.SetActive(false);
    }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     thisPlantsState = PlantStates.sprout;
     transform.localScale = new Vector3 (startsize, startsize, 1);
     startHeight= transform.position.y - startPositionOffset;
     endHeight = transform.position.y;
     //transform.position.y = startHeight - startPositionOffset;
 }
Пример #3
0
 public void Plant()
 {
     if (_age == PlantStates.Empty)
     {
         _age = PlantStates.Seeds;
         seedsPrefab.SetActive(true);
     }
 }
Пример #4
0
        public void GetPlantStateTest()
        {
            //ARRANGE
            var        plantState     = new PlantStates();
            PlantState plant          = PlantState.healthy;
            var        expectedResult = "healthy";

            //ACT
            PlantState result = plantState.GetPlantState(expectedResult);

            //ASSERT
            Assert.AreEqual(expectedResult, result);
        }
Пример #5
0
 public bool Harvested()
 {
     if (_age == PlantStates.Adult)
     {
         _age = PlantStates.Empty;
         seedsPrefab.SetActive(false);
         youngPrefab.SetActive(false);
         adultPrefab.SetActive(false);
         wateredPlot.SetActive(false);
         overWateredPlot.SetActive(false);
         drownedPlot.SetActive(false);
         return(true);
     }
     return(false);
 }
Пример #6
0
 void Start()
 {
     _age    = PlantStates.Empty;
     _health = HealthStates.Dry;
     seedsPrefab.SetActive(true);
     youngPrefab.SetActive(true);
     adultPrefab.SetActive(true);
     wateredPlot.SetActive(true);
     overWateredPlot.SetActive(true);
     drownedPlot.SetActive(true);
     seedsPrefab.SetActive(false);
     youngPrefab.SetActive(false);
     adultPrefab.SetActive(false);
     wateredPlot.SetActive(false);
     overWateredPlot.SetActive(false);
     drownedPlot.SetActive(false);
 }
Пример #7
0
 public void SetAge(PlantStates age)
 {
     _age = age;
 }