public void Plant() { if (seedTimer < 0) { isPlant = false; m_seed.GetComponentInChildren <SpriteRenderer>().sortingLayerName = "Default"; m_seed.GetComponentInChildren <SpriteRenderer>().sortingOrder = 0; m_seed.CreateRoot(m_velocity.normalized); m_seed.transform.parent = null; m_seed = null; seedTimer = seedRenewDuration; } }
public bool GetSeed(PlantSeed seed) { if (!isPlant) { Debug.Log("Plant " + seed.name); isPlant = true; m_seed = seed; m_seed.transform.parent = transform; m_seed.transform.localPosition = Vector3.up * 0.33f; m_seed.GetComponentInChildren <SpriteRenderer>().sortingLayerName = "Player"; m_seed.GetComponentInChildren <SpriteRenderer>().sortingOrder = 10; m_source.clip = pickSound; m_source.Play(); return(true); } return(false); }