// calculate a single target position from all our targets private Vector3 CalculateTargetPosition() { if (null == _targets || 0 == _targets.Count) { return(Vector3.zero); } return(GameUtils.CalculateBoundsWithOffset(_targets).center); }
public void CurrentCameraLookAt(ref List <GameObject> targets, float HangonTime) { State = MotionState.LookAt; if (MyFollowCamera.Instance) { MyFollowCamera.Instance.isActive = false; } Vector3 target_pos = GameUtils.CalculateBoundsWithOffset(targets).center; CameraLookAt(target_pos); _lookAtHangonTime = HangonTime; _listTargets = targets; }
public void BlendCurrentCamera(ref List <GameObject> targets, float distOffset, float pitchOffset, float yawOffset, float heightOffset, CameraLerp lerp) { GameCameraParams param = ScriptableObject.CreateInstance <GameCameraParams>(); if (param == null) { EB.Debug.LogError("Failed to create GameCameraParams instance in CombatCamera.BlendCurrentCamera"); } if (targets == null || targets.Count == 0) { return; } Vector3 target_pos = GameUtils.CalculateBoundsWithOffset(targets).center; Vector3 camera_pos = transform.position; float dist = Vector3.Distance(camera_pos, target_pos); param.distance = dist + distOffset; param.pitch = pitchOffset; param.yawOffset = yawOffset; param.heightOffset = heightOffset; EnterInteractionCamera(ref targets, ref param, lerp); }
private void UpdateCurrentLookAtState(float deltaTime) { if (MyFollowCamera.Instance) { MyFollowCamera.Instance.isActive = false; } if (_lookAtHangonTime > 0) { _lookAtHangonTime -= deltaTime; if (_listTargets != null) { Vector3 target_pos = GameUtils.CalculateBoundsWithOffset(_listTargets).center; CameraLookAt(target_pos); } } else { State = CombatCamera.MotionState.Freedom; if (MyFollowCamera.Instance) { MyFollowCamera.Instance.isActive = true; } } }