Beispiel #1
0
    public void OnPlotStateSwitch(FarmPlot.State state, FarmPlot.State previousState, FarmPlot plot)
    {
        if (state != FarmPlot.State.Growing)
        {
            _continueSpawning = false;
            _flee             = true;
            OnFlee();
        }

        if (state == FarmPlot.State.Healing)
        {
        }
    }
Beispiel #2
0
 private void SpawnAnimatedTool(FarmPlot plot, FarmPlot.State state, FarmPlot.State currentState)
 {
     for (var i = 0; i < _playStates.Count; ++i)
     {
         if (_playStates[i] == state &&
             (_playAfterStates[i] == currentState || _playAfterStates[i] == FarmPlot.State.Undifined))
         {
             var farmTool = Instantiate(_farmTools[i]);
             _farmPlotAnimatedTools.Add(plot, farmTool);
             farmTool.GetComponent <Animator>().SetBool("isPlaying", true);
             farmTool.transform.position = plot.transform.position + _spawnOffset[i];
             break;
         }
     }
 }
Beispiel #3
0
 public void OnPlotStartStateSwitch(FarmPlot.State state, FarmPlot.State previousState, FarmPlot plot)
 {
 }
Beispiel #4
0
 public void OnPlotStateSwitch(FarmPlot.State state, FarmPlot.State previousState, FarmPlot plot)
 {
     if (state == FarmPlot.State.Dug && !_plantQuestStarted)
     {
         Debug.Log("Start plant quest");
         _plantQuestStarted = true;
         _startPlantQuestEvent.Invoke();
     }
     else if (state == FarmPlot.State.Planted && !_waterQuestStarted)
     {
         _waterQuestStarted = true;
         _startWaterQuestEvent.Invoke();
     }
     else if (state == FarmPlot.State.Growing)
     {
     }
     else if (state == FarmPlot.State.Grown)
     {
         if (_firstHarvest)
         {
             _firstHarvest = false;
             _harvestHand.SetActive(true);
             _harvestTweenStart = Camera.main.WorldToScreenPoint(plot.transform.position);
             Vector2 truckPos = Camera.main.WorldToScreenPoint(_truck.transform.position);
             _harvestHand.transform.position = _harvestTweenStart;
             _harvestHand.transform.DOMove(truckPos, 1.5f);
         }
     }
     else if (state == FarmPlot.State.Harvested)
     {
         if (!_firstHarvestCompleted)
         {
             _firstHarvestCompleted = true;
             DOTween.Kill(_harvestHand.transform);
             _harvestHand.SetActive(false);
         }
     }
     else if (state == FarmPlot.State.Decay)
     {
         if (_firstSpray)
         {
             _firstSpray = false;
             _sprayHand.SetActive(true);
             _sprayTweenEnd = Camera.main.WorldToScreenPoint(plot.transform.position);
             _sprayHand.transform.position = _sprayTool.transform.position;
             _sprayHand.transform.DOMove(_sprayTweenEnd, 1.5f);
         }
     }
     else if (state == FarmPlot.State.Healing)
     {
         if (!_firstSprayCompleted)
         {
             _firstSprayCompleted = true;
             DOTween.Kill(_sprayHand.transform);
             _sprayHand.SetActive(false);
         }
     }
     else if (state == FarmPlot.State.Withered)
     {
         if (!_firstSprayCompleted)
         {
             _firstSprayCompleted = true;
             DOTween.Kill(_sprayHand.transform);
             _sprayHand.SetActive(false);
             _failBugKillEvent.Invoke();
         }
     }
 }
Beispiel #5
0
 public void OnPlotStateSwitch(FarmPlot.State state, FarmPlot.State previousState, FarmPlot plot)
 {
     DestroyAnimatedTool(plot);
 }
Beispiel #6
0
 public void OnPlotStartStateSwitch(FarmPlot.State switchState, FarmPlot.State currentState, FarmPlot plot)
 {
     SpawnAnimatedTool(plot, switchState, currentState);
 }