Esempio n. 1
0
    private void OnTriggerEnter(Collider other)
    {
        if (isPunching && !isRecovering)
        {
            if (other.gameObject.tag.Equals("Player") &&
                !gameObject.transform.parent.gameObject.Equals(other.gameObject))
            {
                Player player = other.gameObject.GetComponent <Player>();
                if (player.IsAlive)
                {
                    DamagePlayer(player);
                    var hitSound = GetComponent <AudioSource>();

                    hitSound.clip = PickSound();

                    hitSound.Play();
                }
            }
            else if (other.gameObject.tag.Equals("BOOMHOOCH"))
            {
                var hitSound = GetComponent <AudioSource>();

                hitSound.clip = objectHitClip;
                hitSound.Play();

                BoomHoochActivate killSwitch = other.gameObject.GetComponent <BoomHoochActivate>();
                killSwitch.GoBoomBoom();
            }
            else if (other.gameObject.tag.Equals("JUKE BOX"))
            {
                var hitSound = GetComponent <AudioSource>();

                hitSound.clip = objectHitClip;
                hitSound.Play();

                other.gameObject.GetComponent <JukeBox>().SmashJuke();
            }
            else
            {
                var hitSound = GetComponent <AudioSource>();
                hitSound.clip = objectHitClip;
                hitSound.Play();
            }


            if (!gameObject.transform.parent.gameObject.Equals(other.gameObject))
            {
                UseStrike();
            }
        }
    }
Esempio n. 2
0
    private void OnTriggerEnter(Collider other)
    {
        /*
         * #ERROR threw up an error when a player was killed with a cigar
         * NullReferenceException: Object reference not set to an instance of an object
         * BoomHoochConcuss.OnTriggerEnter (UnityEngine.Collider other) (at Assets/Scripts/BoomHoochConcuss.cs:9)
         */
        if (other.gameObject.tag.Equals("Player") && transform.parent.GetComponent <BoomHoochActivate>().isBoom)
        {
            Player player = other.gameObject.GetComponent <Player>();
            player.TakeDamage(20);
        }

        if (other.gameObject.tag.Equals("BOOMHOOCH"))
        {
            BoomHoochActivate killSwitch = other.gameObject.GetComponent <BoomHoochActivate>();
            killSwitch.GoBoomBoom();
        }
    }