コード例 #1
0
ファイル: BerryBushv2.cs プロジェクト: rykerrr/rocky
 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);
             }
         }
     }
 }