Пример #1
0
 void Start()
 {
     berryCount = 0;
     if (!berryBushScript)
     {
         berryBushScript = GetComponent <ResourceGiverScript>();
     }
     SpawnBerries();
 }
Пример #2
0
 private void OnTriggerStay2D(Collider2D other)
 {
     if (wepScript.swinging)
     {
         if (other.CompareTag("Resource")) // Stone Wood Food
         {
             ResourceGiverScript resScript = other.GetComponent <ResourceGiverScript>();
             if (resScript.typeOfResource == "Stone")
             {
                 Player.stoneResource += resScript.TakeResource(resourceGain);
             }
             if (resScript.typeOfResource == "Wood")
             {
                 Player.woodResource += resScript.TakeResource(resourceGain);
             }
             if (resScript.typeOfResource == "Food")
             {
                 Player.foodResource += resScript.TakeResource(resourceGain);
             }
         }
     }
 }