상속: MonoBehaviour
예제 #1
0
    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);
        }
    }
예제 #2
0
    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;
            }
        }
    }