void Awake() { spriteHeight = GetComponent <SpriteRenderer>().sprite.bounds.size.y; anim = GetComponent <Animator>(); bottomPosition = new Vector3(0, -spriteHeight * 0.5f, 0); if (GameObject.Find("DonkeyKong") != null) { barrelSpawner = GameObject.Find("DonkeyKong").GetComponent <BarrelSpawner>(); } soundEffectPlayer = gameObject.AddComponent <SoundEffectPlayer>(); if (GameObject.Find("GameOver") != null) { gameOverSprite = GameObject.Find("GameOver").GetComponent <SpriteRenderer>(); } }
void Awake() { anim = GetComponent <Animator>(); GameObject bottomPos = new GameObject(); bottomPos.transform.parent = transform; bottomPos.transform.localPosition = new Vector3(0, -0.07980061f, 0); bottomPos.name = "BottomPos"; bottomTransform = bottomPos.transform; if (GameObject.Find("DonkeyKong") != null) { barrelSpawner = GameObject.Find("DonkeyKong").GetComponent <BarrelSpawner>(); } soundEffectPlayer = gameObject.AddComponent <SoundEffectPlayer>(); if (GameObject.Find("GameOver") != null) { gameOverSprite = GameObject.Find("GameOver").GetComponent <SpriteRenderer>(); } }