private void LateUpdate() { if (cameraLink == null) { cameraLink = GetComponent <LinkCamera>(); } if (entityLink == null) { entityLink = GetComponent <LinkEntity>(); } if (cameraLink == null || entityLink == null) { return; } if (cameraLink.active == null) { return; } if (entityLink.linked == null || UMMO.IsDead(entityLink.linked)) { cameraLink.active.transform.position = Vector3.zero; return; } DX4D.Follow(cameraLink.active.transform, entityLink.linked.transform, followOffset); LookAt(cameraLink.active, entityLink.linked); }
//CONFIG Vector3 GetOffsets() { if (entityLink == null || entityLink.linked == null) { return(cameraOffset); } return(cameraOffset + (UMMO.IsMoving(entityLink.linked) ? cameraOffsetWhileMoving : Vector3.zero) + (UMMO.IsCasting(entityLink.linked) ? cameraOffsetWhileCasting : Vector3.zero)); }
//UPDATE void Update() { LoadLinks(); if (cameraLink == null || entityLink == null) { return; } if (cameraLink.active == null) { return; } followOffset = GetOffsets(); DX4D.ChangeCameraView(cameraLink.active, cameraZoom, cameraFieldOfView, showLayers); if (entityLink.linked == null || UMMO.IsDead(entityLink.linked)) { cameraLink.active.transform.position = Vector3.zero; return; } DX4D.Follow(cameraLink.active.transform, entityLink.linked.transform, followOffset); ConfigureCameraLookAt(cameraLink.active, entityLink.linked); }