コード例 #1
0
    private void OnTriggerEnter(Collider other)
    {
        // Debug.Log(other.transform.name);
        Interactable interactable = other.GetComponent <Interactable>();

        if (interactable != null)
        {
            SetFocus(interactable);
        }

        if (other.transform.name == "Grass" || other.transform.name == "Bush")
        {
            hidingCount += 1;
            if (hidingCount > 0)
            {
                trueHiding = true;
                hiding     = true;
            }
            //Debug.Log(other.transform.name);
        }
        if (other.transform.name == "WaterBasicDaytime")
        {
            if (falling >= 2f)
            {
                sounds.SplashAudio();
            }
            swimming = true;
            //Debug.Log(other.transform.name);
        }
        if (other.transform.name == "DoorWay2")
        {
            // PlayerManager.instance.playerPos = transform;
            // previousPosition = transform;
            //teleportDestination = other.GetComponent<Scenes>().destination;
            // Debug.Log(other.GetComponent<Scenes>().destination.position);
            //Debug.Log("prev" + previousPosition.position);
            //Debug.Log("prev ins" + PlayerManager.instance.playerPos.position);
            //teleport = true;
        }
        if (other.transform.name == "DoorWayExit")
        {
            // Debug.Log("prev" + previousPosition.position);
            teleportDestination = PlayerManager.instance.playerPos;
            teleport            = true;
        }
    }