Exemple #1
0
    private void RespawnPlayer()
    {
        PlayerMovement   playerMov  = GetComponentInParent <PlayerMovement>();
        PlayerContainers playerCont = playerMov.GetComponent <PlayerContainers>();
        HandMovement     playerHand = playerMov.GetComponentInChildren <HandMovement>();

        playerMov.ChangeControl(true);
        playerCont.ChangeControl(true);
        playerHand.ChangeControl(true);
    }
    private IEnumerator UnlockCR()
    {
        int repeats = 5;
        int current = 0;

        while (current < repeats)
        {
            currentBlink += blinkSpeed * Time.deltaTime;

            if (currentBlink > 1f)
            {
                goingToBlack = !goingToBlack;
                currentBlink = 0f;

                current++;
            }

            if (goingToBlack)
            {
                Color targetColor = Color.Lerp(Color.blue, Color.red, currentBlink);
                targetColor.a        = 1;
                highLightImage.color = targetColor;
            }
            else
            {
                Color targetColor = Color.Lerp(Color.red, Color.blue, currentBlink);
                targetColor.a        = 1;
                highLightImage.color = targetColor;
            }


            yield return(null);
        }

        PlayerContainers player = FindObjectOfType <PlayerContainers>();

        if (player.GetCurrentContainer() == this)
        {
            GreyBackground();
            HighLight();
        }
        else
        {
            StopHighLight();
        }

        yield break;
    }
Exemple #3
0
    public void Death()
    {
        if (dead == false)
        {
            audioS.PlayOneShot(deathSound);
            dead = true;
            anim.SetBool("Dead", true);

            PlayerMovement   playerMov  = GetComponentInParent <PlayerMovement>();
            PlayerContainers playerCont = playerMov.GetComponent <PlayerContainers>();
            HandMovement     playerHand = playerMov.GetComponentInChildren <HandMovement>();

            playerMov.ChangeControl(false);
            playerCont.ChangeControl(false);
            playerHand.ChangeControl(false);

            StartCoroutine(RespawnPlayerCR(deathSound.length));
        }
    }
Exemple #4
0
    public void SetPlayerControl(bool hasControl)
    {
        playerHasControl = hasControl;
        Cursor.visible   = !hasControl;

        // TODO: Disable all player contrables at once.
        PlayerMovement   playerMov        = FindObjectOfType <PlayerMovement>();
        PlayerContainers playerCont       = playerMov.GetComponent <PlayerContainers>();
        HandMovement     playerHand       = playerMov.GetComponentInChildren <HandMovement>();
        ProjectilePath   playerProjectile = playerMov.GetComponentInChildren <ProjectilePath>();

        playerMov.ChangeControl(hasControl);
        playerCont.ChangeControl(hasControl);
        playerHand.ChangeControl(hasControl);
        playerProjectile.ChangeControl(hasControl);


        //TODO: Check this one out.
        // It highlights the first button in the menu if there is no mouse.
        //StartCoroutine(HighLightBtnCR());
    }
Exemple #5
0
 private void Start()
 {
     containers = transform.parent.GetComponentInChildren <PlayerContainers>();
     instructions.Add(collectingCanvas);
 }