Example #1
0
    public void ChangeDimension()
    {
        if (!Active)
        {
            return;
        }

        int layerMask = LayerMask.GetMask(currentCameraType.ToString());

        if (_displayCamera.cullingMask == layerMask)
        {
            return;
        }

        ChangingDimension?.Invoke();
        StartCoroutine(FlashCamera());

        _displayCamera.cullingMask = layerMask;
        _OutlineCamera.cullingMask = layerMask;
        int layer = LayerMask.NameToLayer(currentCameraType.ToString());

        gameObject.layer = layer;

        LayerUtils.SetChildLayerRecursivly(transform, layer);

        foreach (GameObject obj in _objectsToSwitchDimensions)
        {
            obj.layer = layer;
            LayerUtils.SetChildLayerRecursivly(obj.transform, layer);
        }

        SetActive(false, false);
    }
Example #2
0
    private void HandleTimeCameraInput()
    {
        if (!useTimeCamera)
        {
            return;
        }

        if (Input.GetKey(KeyCode.Alpha1))
        {
            TimeCamera.SwapCamera(CameraType.Past);
        }

        else if (Input.GetKey(KeyCode.Alpha2))
        {
            TimeCamera.SwapCamera(CameraType.Present);
        }

        else if (Input.GetKey(KeyCode.Alpha3))
        {
            TimeCamera.SwapCamera(CameraType.Future);
        }

        else if (Input.GetKey(KeyCode.Mouse0))
        {
            if (CanSwitchDimenstion)
            {
                TimeCamera.ChangeDimension();

                gameObject.layer = TimeCamera.CurrentLayer;

                if (HeldObject)
                {
                    HeldObject.gameObject.layer = TimeCamera.CurrentLayer;
                    LayerUtils.SetChildLayerRecursivly(HeldObject.gameObject.transform, TimeCamera.CurrentLayer);
                }
            }
        }

        else if (Input.GetKeyDown(KeyCode.Q))
        {
            TimeCamera.SetActive(!TimeCameraActive);
        }

        else if (Input.GetKeyDown(KeyCode.Mouse1))
        {
            TimeCamera.SetZoom(true);
        }

        else if (Input.GetKeyUp(KeyCode.Mouse1))
        {
            TimeCamera.SetZoom(false);
        }
    }