Пример #1
0
 public void PlantSeed(Seed seed, PlantBox box, Action onComplete, Action onFailed)
 {
     if (box.IsFull)
     {
         onFailed?.Invoke();
     }
     else
     {
         box.PlantSeed(seed);
         onComplete?.Invoke();
     }
 }
Пример #2
0
 private void PlantCallBack(PlantBox box, SeedBox seedBox)
 {
     if (box == null || seedBox == null)
     {
         return;
     }
     if (box.IsFull || !seedBox.IsFull)
     {
         return;
     }
     box.PlantSeed(seedBox._currentSeed);
     seedBox.RemoveSeed();
     SaveSeeds();
 }
Пример #3
0
 private void PlantBoxSelected(PlantBox _box)
 {
     if (_box.IsFull && _box.fullyGrown && !_box._hasReturnedSeed)
     {
         // Try Harvest
         if (_seedBoxContainer.HasEmptySpace)
         {
             Seed _seed = _box.Harvest();
             if (_seed != null)
             {
                 _seedBoxContainer.AddToSlot(_seed);
                 SaveSeeds();
             }
         }
         else if (_box.IsFull)
         {
             if (PlantInteractorView.Instance != null)
             {
                 PlantInteractorView.Instance.OpenPanel(_box);
             }
         }
     }
     else if (!_box.IsFull && _selectedBox != null && _selectedBox.IsFull)
     {
         _box.PlantSeed(_selectedBox._currentSeed);
         _selectedBox.RemoveSeed();
     }
     else if (_box.IsFull)
     {
         if (PlantInteractorView.Instance != null)
         {
             PlantInteractorView.Instance.OpenPanel(_box);
         }
     }
     _selectedBox = null;
     SaveSeeds();
 }