Exemplo n.º 1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player_1_HeadCollider")
        {
            gameController.Decrease_Player_2_Stamina();

            Debug.Log("Player 1 - head hit");

            Instantiate(attackSFX, this.transform.position, Quaternion.identity);
            gameController.HeadHit_Player1();
            gameController.DecreaseNumberOfHits();
            DoHeadDamage();
        }

        if (other.tag == "Player_1_BodyCollider")
        {
            gameController.Decrease_Player_2_Stamina();

            Debug.Log("Player 1 - body hit");
            Instantiate(attackSFX, this.transform.position, Quaternion.identity);
            gameController.BodyHit_Player1();
            gameController.DecreaseNumberOfHits();
            DoBodyDamage();
        }

        if (other.tag == "Player_1_LegsCollider")
        {
            gameController.Decrease_Player_2_Stamina();

            Debug.Log("Player 1 - legs hit");
            Instantiate(attackSFX, this.transform.position, Quaternion.identity);
            gameController.LegsHit_Player1();
            gameController.DecreaseNumberOfHits();
            DoLegsDamage();
        }

        // If collider hits defending hit box
        if (other.tag == "Player_1_HeadDefending")
        {
            gameController.Decrease_Player_2_Stamina();

            Debug.Log("Player 1 - head block");
            //Instantiate(attackSFX, this.transform.position, Quaternion.identity);
            Instantiate(blockSFX, this.transform.position, Quaternion.identity);
            uiM.BlockOverlay_ON();

            gameController.DecreaseNumberOfHits();
        }

        if (other.tag == "Player_1_BodyDefending")
        {
            gameController.Decrease_Player_2_Stamina();

            Debug.Log("Player 1 - body block");
            //Instantiate(attackSFX, this.transform.position, Quaternion.identity);
            Instantiate(blockSFX, this.transform.position, Quaternion.identity);

            uiM.BlockOverlay_ON();

            gameController.DecreaseNumberOfHits();
        }

        if (other.tag == "Player_1_LegsDefending")
        {
            gameController.Decrease_Player_2_Stamina();

            Debug.Log("Player 1 - legs block");
            //Instantiate(attackSFX, this.transform.position, Quaternion.identity);
            Instantiate(blockSFX, this.transform.position, Quaternion.identity);

            uiM.BlockOverlay_ON();

            gameController.DecreaseNumberOfHits();
        }
    }