예제 #1
0
    void OnTriggerStay(Collider other)
    {
        if (other.gameObject.CompareTag("SteppingStone"))
        {
            isStepping = true;
        }

        /* LEGACY
         * if (other.gameObject.CompareTag("Stepping"))
         * {
         *  isStepping = !stepScript.IsDrop;
         * }
         */
        if (other.CompareTag("ArrowGun"))
        {
            if (arrowGunController == null)
            {
                arrowGunController = other.GetComponent <ArrowGunController>();
            }

            if (arrowGunController.isAlertOn)
            {
                Alert.SetActive(true);
                isArrowAlertOn = true;
            }
            else
            {
                Alert.SetActive(false);
                isArrowAlertOn = false;
            }
        }

        if (other.CompareTag("Gasi"))
        {
            if (gasiController == null)
            {
                gasiController = other.GetComponent <GasiController>();
            }

            if (gasiController.isAlert)
            {
                Alert.SetActive(true);
                isGasiAlertOn = true;
            }
            else
            {
                Alert.SetActive(false);
                isGasiAlertOn = false;
            }
        }

        if (other.gameObject.CompareTag("Water"))
        {
            if (!isStepping)
            {
                isWater = true;
            }
        }
    }
예제 #2
0
    void OnTriggerExit(Collider other)
    {
        PanelController panelScript = panel.GetComponent <PanelController>();

        if (other.gameObject.CompareTag("SteppingStone"))
        {
            isStepping = false;
        }

        if (other.CompareTag("ArrowGun"))
        {
            arrowGunController = null;
            isArrowAlertOn     = false;
        }

        if (other.CompareTag("Gasi"))
        {
            gasiController = null;
            isGasiAlertOn  = false;
        }

        if (other.gameObject.CompareTag("Water"))
        {
            isWater = false;

            if (!isStepping)
            {
                //Time.timeScale = 0.6f;

                StartCoroutine("DeadDirection");

                isOver = true;
                audioSource.PlayOneShot(deadSound, audioVolume);
                Debug.Log("Game Over by Water");
            }
        }
        // 콜라이더에서 나갈 때엔 항상 꺼준다.
        Alert.SetActive(false);
    }