Esempio n. 1
0
    void Update()
    {
        ProcessLoadingAudio();
        ProcessMenus();

        InteractionSensor sensor = PlayerWithinInteractionSensor();
        bool showOverlay         = (sensor != null && sensor.CanDisplayUITrigger());

        if (showOverlay != ShowingInteractionMenu())
        {
            ShowInteractionMenu(showOverlay);
        }

        ProcessAutoReturnToTitleScreen();
    }
    void FpsInteract()
    {
        enterTextMesh.enabled   = false;
        needRedTextMesh.enabled = false;

        if (skipInteractionFrame > 0)
        {
            skipInteractionFrame -= 1;
            return;
        }

        bool interactedTriggeres = playerInput.inputActions.Interact.triggered;

        RaycastHit hitInfo;

        if (Physics.Raycast(fpsCamera.transform.position, fpsCamera.transform.forward, out hitInfo, 0.8f, 1 << 10))
        {
            Portal portal = hitInfo.collider.GetComponent <Portal>();
            if (portal != null)
            {
                enterTextMesh.enabled = true;

                if (interactedTriggeres)
                {
                    Debug.Log($"hit {portal.name}");
                    skipInteractionFrame = 8;
                    portal.EnterPortal();
                }
            }

            DoorObstacle doorObs = hitInfo.collider.GetComponentInParent <DoorObstacle>();
            if (doorObs != null)
            {
                needRedTextMesh.enabled = true;
            }

            InteractionSensor inter_sensor = hitInfo.collider.GetComponent <InteractionSensor>();
            if (inter_sensor != null)
            {
                enterTextMesh.enabled = true;
                if (interactedTriggeres)
                {
                    inter_sensor.OnInteractionTriggered();
                }
            }
        }
    }
Esempio n. 3
0
 public void InteractionSensorReport(InteractionSensor sensor)
 {
     m_InteractionSensorReporting[sensor] = sensor.PlayerWithin();
 }