Esempio n. 1
0
    //--------------------------------------------------------------------------------
    // Function is called when script first runs.
    //--------------------------------------------------------------------------------
    void Awake()
    {
        // Gets the Striker's Rigidbody and stores it in variable
        rigidBody = GetComponent <Rigidbody>();

        // Gets components from the Sweeper Special script
        sweeperSpecial = GetComponent <SweeperSpecial>();

        // Gets component from the Striker Special script
        strikerSpecial = GetComponent <StrikerSpecial>();

        // Sets previous rotation x and z to both be zero
        prevRotateX = 0f;
        prevRotateZ = 0f;
    }
Esempio n. 2
0
    //-----------------------------------------------------------------------------
    // Function limits actions for player when called
    //-----------------------------------------------------------------------------
    private void Death()
    {
        // Dead bool is set to true
        dead = true;

        // Animator Dead bool is set to true
        animator.SetBool("Dead", true);

        // Freezes all body constraints on dead player
        body.constraints = RigidbodyConstraints.FreezeAll;

        // Adds the "!" above the dead player
        helpMe.SetActive(true);

        // Gets Sweeper and Striker's Special components
        SweeperSpecial specialSweeper = GetComponent <SweeperSpecial>();
        StrikerSpecial specialStriker = GetComponent <StrikerSpecial>();

        // Gets Player Move and Player Attack components
        PlayerMove   PlayMove   = GetComponent <PlayerMove>();
        PlayerAttack playAttack = GetComponent <PlayerAttack>();

        // If there is a Striker Special then disable the component
        if (specialStriker)
        {
            specialStriker.enabled = false;
        }

        // If there is a Sweeper Special then disable the component
        if (specialSweeper)
        {
            specialSweeper.enabled = false;
        }

        // If there is a Player Move then disable the component
        if (PlayMove)
        {
            PlayMove.enabled = false;
        }

        // If there is a Player Attack then disable the component
        if (playAttack)
        {
            playAttack.enabled = false;
        }
    }
Esempio n. 3
0
    void revive()
    {
        // Gets Sweeper and Striker's Special components
        SweeperSpecial specialSweeper = GetComponent <SweeperSpecial>();
        StrikerSpecial specialStriker = GetComponent <StrikerSpecial>();

        // Gets Player Move and Player Attack components
        PlayerMove PlayMove = GetComponent <PlayerMove>();

        PlayerAttack playAttack = GetComponent <PlayerAttack>();



        //sets the players rigid body constraints back to waht they where when they lived
        healthPlayer.body.constraints = RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;


        // If there is a Striker Special then disable the component
        if (specialStriker)
        {
            specialStriker.enabled = true;
        }

        // If there is a Sweeper Special then disable the component
        if (specialSweeper)
        {
            specialSweeper.enabled = true;
        }

        // If there is a Player Move then disable the component
        if (PlayMove)
        {
            PlayMove.enabled = true;
        }

        // If there is a Player Attack then disable the component
        if (playAttack)
        {
            playAttack.enabled = true;
        }
        healthPlayer.helpMe.SetActive(false); //sets the players help me icon to false
        animator.SetBool("Dead", false);      //sets the players death animation to false
    }