Esempio n. 1
0
    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>();
        }
    }
Esempio n. 2
0
    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>();
        }
    }