예제 #1
0
    void suffocate()
    {
        //isSuffocating = true;
        playerStateScript.SetIsSuffocating(true);
        //print("isSuffocating set true");
        breath_count = 0;

        // trigger the breathing icon to dead
//		iconIndicator.SetTrigger ("is_dead");
//		iconIndicator.SetBool("isDead", true);

        // the beaver should pass through obstacles when they are suffocating
        transform.FindChild("Beaver").gameObject.layer = LayerMask.NameToLayer("Suffocating");                   //The beaver collider
        beaverMouth.transform.FindChild("beaver_mouth").gameObject.layer = LayerMask.NameToLayer("Suffocating"); // The mouth collider

        //drop the pearl, 180 = downwards,
        throwingScript.ThrowPearl(180.0f, dropPearlForce);
        playerStateScript.SetHasPearl(false);

        //movingScript.enabled = false; // disables movement, dashing, throwing
        movingScript.SetMoveForce(constants.moveForceSlow);
        dashScript.enabled      = false;
        throwingScript.enabled  = false;
        colDetectScript.enabled = false;
        beaverPearlCollider.GetComponent <Collider2D>().enabled = false;
        animator.SetTrigger("breathing_in");         // sets animator trigger so that suffocation animation is played
        Invoke("floating", suffocate_time);          // switch to floating after "suffocate_time" amount of seconds
    }
예제 #2
0
    public void Damage()
    {
        playerStateScript.SetIsHit(true);
        soundPlayer.PlayClip(hitSound, 0.6f);
        movingScript.enabled   = false;       // disables movement, dashing, throwing
        throwingScript.enabled = false;
        animator.SetTrigger("is_hit");        // sets animator trigger so that suffocation animation is played

        //throw the pearl in the direction of enemy dash
        throwingScript.ThrowPearl(playerStateScript.GetAimingAngle(), dropPearlForce);

        //become able to move again
        Invoke("RestartState", 1.5f);

        //player flashes red
        //playerHit.GetComponent<Animation>().Play("Player_RedFlash");
    }