Ejemplo n.º 1
0
    private void OnTriggerEnter(Collider other)
    {
        if (!isActivated)
        {
            if (!other.transform.CompareTag("Untagged"))
            {
                Debug.Log("함정 발동");
                isActivated   = true;
                theAudio.clip = sound_Activate;
                theAudio.Play();
                Destroy(go_Meat);

                for (int i = 0; i < rigid.Length; i++)
                {
                    rigid[i].useGravity  = true;
                    rigid[i].isKinematic = false;
                }

                if (other.transform.name == "Player")
                {
                    Debug.Log("함정 충돌 데미지 입음");
                    theStatusController.DecreaseHp(damage);
                }
            }
        }
    }
Ejemplo n.º 2
0
    private void OxygenStatus()
    {
        if (GameManager.isWater)
        {
            theOxygen.CurrentOxygen          -= 10f * Time.deltaTime;
            theOxygen.Text_currentOxygen.text = Mathf.RoundToInt(theOxygen.CurrentOxygen).ToString() + " / 100";
            theOxygen.Image_gauge.fillAmount  = theOxygen.CurrentOxygen / theOxygen.TotalOxygen;

            if (theOxygen.CurrentOxygen <= 0)
            {
                theOxygen.CurrentOxygen = 0;
                theStatusController.DecreaseHp(1);
            }
        }
        else
        {
            theOxygen.CurrentOxygen          += 10f * Time.deltaTime;
            theOxygen.Text_currentOxygen.text = Mathf.RoundToInt(theOxygen.CurrentOxygen).ToString() + " / 100";
            theOxygen.Image_gauge.fillAmount  = theOxygen.CurrentOxygen / theOxygen.TotalOxygen;

            if (theOxygen.CurrentOxygen >= theOxygen.TotalOxygen)
            {
                theOxygen.CurrentOxygen = theOxygen.TotalOxygen;
            }
        }
    }