private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Icicles") { health -= 100; } SnowballScript snowball = other.gameObject.GetComponent <SnowballScript>(); }
private void LoadSnowball() { if (snowball != null) { Destroy(snowball); } snowball = Instantiate(snowballPrefab); snowball.transform.localPosition = currentLevel.transform.Find("Grid").Find("Spawn").transform.localPosition; SnowballScript snowballScript = snowball.transform.GetChild(0).gameObject.GetComponent <SnowballScript>(); currentLevel.transform.Find("Grid").Find("Ground").gameObject.GetComponent <TilemapCollisionScript>().snowball = snowballScript; snowballScript.gameScript = this; snowball.SetActive(true); }