IEnumerator CreditsCameraSequence()
    {
        for (int i = 0; i < CameraSequence.Count; i++)
        {
            CameraBlock c = CameraSequence[i];
            camScript.ChangeCamera(new PlayerCamera.CameraEvent(c.cam.GetComponent <Camera>(), c.transitionTime, c.holdTime, false));

            //fade in objects
            for (int j = 0; j < c.UIObjectsToFadeIn.Count; j++)
            {
                CanvasGroup g = c.UIObjectsToFadeIn[j].GetComponent <CanvasGroup>();
                StartCoroutine(FadeInUIElement(g));
                yield return(new WaitForSeconds(0.5f));
            }

            //fade out objects
            for (int j = 0; j < c.UIObjectsToFadeOut.Count; j++)
            {
                CanvasGroup g = c.UIObjectsToFadeOut[j].GetComponent <CanvasGroup>();
                StartCoroutine(FadeOutUIElement(g));
            }

            yield return(new WaitForSeconds(c.holdTime + c.transitionTime));

            if (i == CameraSequence.Count - 2)
            {
                canvAnim.SetTrigger(fadeOutHash);
            }
        }
    }
Ejemplo n.º 2
0
        public ZoomLimits(float minFov, float maxFov)
        {
            MinFov = minFov;
            MaxFov = maxFov;

            MinWidth = CameraBlock.FovToWidth(minFov);
            MaxWidth = CameraBlock.FovToWidth(maxFov);
        }
Ejemplo n.º 3
0
 public SetCameraPacket()
 {
     HasVariableBlocks = false;
     //Type = PacketType.SetFollowCamProperties;
     Header = new Header();
     Header.Frequency = PacketFrequency.Low;
     Header.ID = 427;
     Header.Reliable = true;
     Camera = new CameraBlock();
 }
Ejemplo n.º 4
0
 public SetCameraPacket()
 {
     HasVariableBlocks = false;
     //Type = PacketType.SetFollowCamProperties;
     Header           = new Header();
     Header.Frequency = PacketFrequency.Low;
     Header.ID        = 427;
     Header.Reliable  = true;
     Camera           = new CameraBlock();
 }
Ejemplo n.º 5
0
    private void OnTriggerExit(Collider other)
    {
        CameraBlock camBlock = other.GetComponent <CameraBlock>();

        if (camBlock != null)
        {
            if (currentCameraBlock == camBlock)
            {
                currentCameraBlock = null;
            }
            return;
        }

        if (other.GetComponent <SpatialSas>() != null)
        {
            currentSpatialSas = null;
            float zOffset = Mathf.Infinity;
            foreach (SpatialLine sl in currentSpatialRoom._spatialLines)
            {
                if (sl.begin.position.x <= transform.position.x && sl.end.position.x >= transform.position.x)
                {
                    float offset = Mathf.Abs(sl.begin.position.z - transform.position.z);
                    if (offset < zOffset)
                    {
                        zOffset               = offset;
                        currentSpatialLine    = sl;
                        isChangingSpatialLine = true;
                        changingLineDirection = (sl.begin.position.z - transform.position.z) > 0 ? 1 : -1;
                    }
                }
            }

            return;
        }

        if (other.CompareTag("Hideout"))
        {
            isHidden = false;
        }
        else if (other.CompareTag("Metal_Casier"))
        {
            overrideSurface = false;
        }
        else if (other.CompareTag("NeedsCentering"))
        {
            needsCentering = false;
        }
        else if (other.CompareTag("Elevator"))
        {
            Elevator elevator = other.GetComponent <Elevator>();
            if (elevator != null)
            {
                isInElevator             = false;
                elevator.isPlayerOnBoard = false;
            }
        }

        else if (other.CompareTag("DetectZone"))
        {
            Enemy e = other.GetComponentInParent <Enemy>();
            e.DetectPlayer(false);
        }
    }
Ejemplo n.º 6
0
    private void OnTriggerEnter(Collider other)
    {
        CameraBlock cameraBlock = other.GetComponent <CameraBlock>();

        if (cameraBlock != null)
        {
            if (cameraBlock == currentCameraBlock)
            {
                return;
            }
            if (currentCameraBlock != null)
            {
                StartCoroutine(CameraBlockChangesCoroutine());
            }
            currentCameraBlock = cameraBlock;
            CameraBlockChanges();
            return;
        }

        SpatialSas spatialSas = other.GetComponent <SpatialSas>();

        if (spatialSas != null)
        {
            currentSpatialSas     = spatialSas;
            currentSpatialLine    = spatialSas.spatialLine;
            isChangingSpatialLine = true;
            changingLineDirection = 1;
            return;
        }

        SpatialRoom spatialRoom = other.GetComponent <SpatialRoom>();

        if (spatialRoom != null)
        {
            currentSpatialRoom = spatialRoom;
            if (currentSpatialSas == null)
            {
                chooseNearestSpatialLine();
            }
            return;
        }
        else if (other.CompareTag("TriggerBipede"))
        {
            if (!triggerBipede)
            {
                triggerBipede = true;
                AkSoundEngine.PostEvent(GameManager.instance.triggerBipede1Sound, GameManager.instance.gameObject);
            }
        }
        else if (other.CompareTag("TriggerPorte"))
        {
            other.GetComponent <TriggerPorte>().SetSpeed();
        }
        else if (other.CompareTag("Metal_Casier"))
        {
            overrideSurface = true;
        }
        else if (other.CompareTag("Hideout"))
        {
            isHidden = true;
        }
        else if (other.CompareTag("DetectZone"))
        {
            Enemy e = other.GetComponentInParent <Enemy>();
            //e.DetectPlayer(true);
            //print("COLLISION ARAIGNEE");
        }
        else if (other.CompareTag("Finish"))
        {
            AkSoundEngine.PostEvent("Stop_Random_Track1", GameManager.instance.gameObject);
            GameManager.instance.camHandler.DestroyTarget();
            UIManager.instance.FadeInEnd();
        }
        else if (other.CompareTag("Elevator"))
        {
            Elevator elevator = other.GetComponent <Elevator>();
            if (elevator != null)
            {
                elevator.isPlayerOnBoard = true;
                elevator.StartMoving();
                animator.SetBool("IsMoving", false);
                isInElevator = true;
                //print("elevator starts moving");
            }
        }
        else if (other.CompareTag("NeedsCentering"))
        {
            needsCentering = true;
        }
    }
Ejemplo n.º 7
0
 private void Awake()
 {
     Instance = this;
     SpawnCamera();
     _mainCamera = Camera.main;
 }
Ejemplo n.º 8
0
 public SetCameraPacket(CameraBlock camera)
     : this()
 {
     Camera = camera;
 }
Ejemplo n.º 9
0
    void Update()
    {
        if (target == null || GameManager.instance.GetIsPaused())
        {
            return;
        }

        Vector3 lookAtPos = player.GetLookAt();

        Vector3 newPosition = target.position + Vector3.ClampMagnitude(lookAtPos - target.position, offset);

        //print(newPosition);
        if (newPosition.y < target.position.y - minYCamera)
        {
            newPosition.y = target.position.y - minYCamera;
        }
        newPosition.z = zStartPosition;

        float cameraYawAngle = player.getCursorPosNormalized().x *cameraYawAngleMultiplier;

        Quaternion newRotate = Quaternion.Euler(0, cameraYawAngle, 0);

        CameraBlock currentCameraBlock = player.getCameraBlock();

        if (currentCameraBlock != null)
        {
            Quaternion targetRotation = Quaternion.LookRotation(lookAtPos - transform.position, Vector3.up);

            if (currentCameraBlock.blockDirection == CameraBlock.BlockDirection.Left)
            {
                if (newPosition.x < currentCameraBlock.gameObject.GetComponent <BoxCollider>().bounds.max.x)
                {
                    newPosition.x = currentCameraBlock.gameObject.GetComponent <BoxCollider>().bounds.max.x;
                }

                if (targetRotation.eulerAngles.y > 0 && targetRotation.eulerAngles.y < 180)
                {
                    targetRotation *= Quaternion.Euler(new Vector3(0, -targetRotation.eulerAngles.y, 0));
                }
            }
            else if (currentCameraBlock.blockDirection == CameraBlock.BlockDirection.Right)
            {
                if (newPosition.x > currentCameraBlock.gameObject.GetComponent <BoxCollider>().bounds.min.x)
                {
                    newPosition.x = currentCameraBlock.gameObject.GetComponent <BoxCollider>().bounds.min.x;
                }

                if (targetRotation.eulerAngles.y > 180)
                {
                    targetRotation *= Quaternion.Euler(new Vector3(0, -targetRotation.eulerAngles.y, 0));
                }
            }
            else if (currentCameraBlock.blockDirection == CameraBlock.BlockDirection.Up)
            {
                if (newPosition.y > currentCameraBlock.gameObject.GetComponent <BoxCollider>().bounds.min.y)
                {
                    newPosition.y = currentCameraBlock.gameObject.GetComponent <BoxCollider>().bounds.min.y;
                }

                if (targetRotation.eulerAngles.x > 0 && targetRotation.eulerAngles.x < 180)
                {
                    targetRotation *= Quaternion.Euler(new Vector3(-targetRotation.eulerAngles.x, 0, 0));
                }
            }
            else if (currentCameraBlock.blockDirection == CameraBlock.BlockDirection.Down)
            {
                if (newPosition.y < currentCameraBlock.gameObject.GetComponent <BoxCollider>().bounds.max.y)
                {
                    newPosition.y = currentCameraBlock.gameObject.GetComponent <BoxCollider>().bounds.max.y;
                }

                if (targetRotation.eulerAngles.x > 180)
                {
                    targetRotation *= Quaternion.Euler(new Vector3(-targetRotation.eulerAngles.x, 0, 0));
                }
            }

            if (targetRotation.eulerAngles.y < 360 - currentCameraBlock.maxCameraYawAngle && targetRotation.eulerAngles.y > 180)
            {
                targetRotation *= Quaternion.Euler(new Vector3(0, 360 - currentCameraBlock.maxCameraYawAngle - targetRotation.eulerAngles.y, 0));
            }
            else if (targetRotation.eulerAngles.y > currentCameraBlock.maxCameraYawAngle && targetRotation.eulerAngles.y < 180)
            {
                targetRotation *= Quaternion.Euler(new Vector3(0, currentCameraBlock.maxCameraYawAngle - targetRotation.eulerAngles.y, 0));
            }

            if (targetRotation.eulerAngles.x < 360 - currentCameraBlock.maxCameraPitchAngle && targetRotation.eulerAngles.x > 180)
            {
                targetRotation *= Quaternion.Euler(new Vector3(360 - currentCameraBlock.maxCameraPitchAngle - targetRotation.eulerAngles.x, 0, 0));
            }
            else if (targetRotation.eulerAngles.x > currentCameraBlock.maxCameraPitchAngle && targetRotation.eulerAngles.x < 180)
            {
                targetRotation *= Quaternion.Euler(new Vector3(currentCameraBlock.maxCameraPitchAngle - targetRotation.eulerAngles.x, 0, 0));
            }

            targetRotation *= Quaternion.Euler(0, 0, -targetRotation.eulerAngles.z);
            GameManager.instance.RotateCamera(targetRotation);
            GameManager.instance.MoveCamera(newPosition);
        }
        else
        {
            GameManager.instance.RotateCamera(newRotate);
            GameManager.instance.MoveCamera(newPosition);
        }
    }
Ejemplo n.º 10
0
 public SetCameraPacket(CameraBlock camera) : this()
 {
     Camera = camera;
 }