void Chop(SoilScript chopSoil) { Tree treeComponent = chopSoil.SoilObject.GenerationPrebabs[chopSoil.SoilObject.generationIndex].GetComponent<Tree>(); if(treeComponent != null && treeComponent.IsChoppable) { JustAxing = true; GenerationManager.Instance.ChangeSoilObject(chopSoil.soilId, treeComponent.ChoppedPrefab); } }
void OnCollisionEnter(Collision collision) { // When the seed is "planted". if (collision.gameObject.CompareTag("Soil")) { if (collision.gameObject.GetComponent <EarthSoilScript> ().EmptyPot) { // The seed disappear (in the soil). //rr.enabled = false; // The soil set to the plant is the object collided. soil = collision.gameObject.GetComponent <SoilScript> (); earthSoil = collision.gameObject.GetComponent <EarthSoilScript> (); rb.isKinematic = true; sc.isTrigger = true; // The seed is now planted. isPlanted = true; } } }