예제 #1
0
 public GrassSeedState(GameObject model, float spawnOddsPerDay, int maxSurvivalDays, GrassLeaf leaf, bool firstSeed)
 {
     _model            = model;
     _spawnOddsPerDay  = spawnOddsPerDay * Mathf.Clamp((1 - leaf.ShadowAtLocation), 0.25f, 1f);
     _survivalDaysLeft = maxSurvivalDays;
     _leaf             = leaf;
     _firstSeed        = firstSeed;
 }
예제 #2
0
        public void DeregisterLeaf(GrassLeaf leaf, bool removeOccupation)
        {
            _removeBuffer.Add(leaf);

            Plant plant = GetComponent <Plant>();

            if (removeOccupation)
            {
                plant.VegetationSys.RemoveOccupationAt(leaf.Position);
            }

            if (_grassSystem.Count == _removeBuffer.Count)
            {
                plant.VegetationSys.RemoveOccupationsBy(plant);
                Destroy(transform.parent.gameObject);
            }
        }
예제 #3
0
 public GrassDormantState(GrassLeaf leaf)
 {
     _leaf = leaf;
 }
예제 #4
0
 public GrassFullyGrownState(GrassLeaf leaf)
 {
     _leaf = leaf;
 }
예제 #5
0
 public GrassGrowingState(GrassLeaf leaf)
 {
     _leaf           = leaf;
     _chanceToSpawn *= (1f - leaf.ShadowAtLocation) * 0.5f + 0.5f;
 }
예제 #6
0
 public GrassConnection(GrassLeaf initiator, GrassLeaf receiver)
 {
     initiator.AddConnection(this);
     receiver.AddConnection(this);
 }