Пример #1
0
    // Update is called once per frame
    void Update()
    {
        //Check for when the sticky wall can have collision when its transparency changes
        //Disable collision
        if (toonShader.canBePainted == true)
        {
            foreach (var sWall in stickyParts)
            {
                sWall.isTrigger = true;
            }
        }

        //Enable collision
        else if (toonShader.canBePainted == false)
        {
            foreach (var sWall in stickyParts)
            {
                sWall.isTrigger = false;
            }
        }

        //Start the countdown that the player can be on the wall
        if (isSticky == true)
        {
            stickable -= Time.deltaTime;

            //Reset timer and wall color
            if (stickable <= 0.0f)
            {
                stickable = resetStickable;
                platform.GetComponent <Renderer>().material = ogWallColor;
                climbablePart.tag       = "Untagged";
                climbablePart.layer     = 0;
                toonShader.canBePainted = true; //Make visible and colorized

                // gameObject.tag = "Untagged";
                // gameObject.layer = 0;

                //Check if the player has no gravity and alterative movement is off
                if (player.GetComponent <Rigidbody>().useGravity == false)
                {
                    player.GetComponent <Rigidbody>().useGravity = true;
                }

                if (player.alterMovement == true)
                {
                    player.alterMovement = false;
                }

                //Prevent horziontal mode from being on
                if (player.stickyHor == true)
                {
                    player.stickyHor = false;
                }

                cooldown = true;
                isSticky = false;
            }
        }

        //Begin cooldown
        if (cooldown == true)
        {
            coolDownTimer -= Time.deltaTime;

            //Stop cooldown
            if (coolDownTimer <= 0.0f)
            {
                coolDownTimer = resetCooldown;
                cooldown      = false;
            }
        }
    }
Пример #2
0
    IEnumerator Dead()
    {
        yield return(new WaitForSeconds(wait));

        player.GetComponent <Animator>().SetBool("isDead", true);
    }