Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        moveDirection.x = Input.GetAxisRaw("Horizontal");
        moveDirection.y = Input.GetAxisRaw("Vertical");
        //Debug.Log(anim.GetFloat("Horizontal"));
        //anim.SetFloat("Horizontal",moveDirection.x);
        pickupFunction();
        if (Input.GetKeyDown(KeyCode.Z))
        {
            dropFunction();
        }
        if (currentHealth <= 0)
        {
            audioSource.enabled = false;
            deathManager.startDeathScreen();
            //Destroy(this.gameObject);
            //this.gameObject.SetActive(false);
        }
        if (isInWater)
        {
            this.transform.GetChild(0).gameObject.SetActive(true);
            speed = waterSpeed;
        }
        else
        {
            this.transform.GetChild(0).gameObject.SetActive(false);
            speed = originalSpeed;
        }
        if (Input.GetKeyDown(KeyCode.E))
        {
            //if in river, drink from river
            if (isInWater)
            {
                gainThirst(20);
            }
            eat();
        }

        if (Input.GetKeyDown(KeyCode.C))
        {
            crafting.SetActive(isCraftingActive);
            isCraftingActive = !isCraftingActive;
        }
        if (win && fireController.walled)
        {
            //winScreen;
            audioSource.enabled = false;
            winManager.startWinScreen();
        }
        else if (win && !fireController.walled)
        {
            takeDamage(-1000);
        }
    }