mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-28 20:43:03 +00:00
3D Camera and Viewport Position Update Fixes (#579)
* Fixed Camera in Rhythm Rally and BTSDS * commet out log * fixed viewport not updating canvas in onBeatChanged
This commit is contained in:
parent
adf5980fc6
commit
6f603cd8b3
17 changed files with 156 additions and 83 deletions
|
@ -38,15 +38,42 @@ namespace HeavenStudio
|
||||||
/**
|
/**
|
||||||
camera's current transformation
|
camera's current transformation
|
||||||
**/
|
**/
|
||||||
private static Vector3 position;
|
private static Vector3 _position;
|
||||||
private static Vector3 rotEluer;
|
private static Vector3 Position
|
||||||
private static Vector3 shakeResult;
|
{
|
||||||
|
get => _position;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_position = value;
|
||||||
|
instance.ApplyCameraValues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static Vector3 _rotEuler;
|
||||||
|
private static Vector3 RotEuler
|
||||||
|
{
|
||||||
|
get => _rotEuler;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_rotEuler = value;
|
||||||
|
instance.ApplyCameraValues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static Vector3 _shakeResult;
|
||||||
|
private static Vector3 ShakeResult
|
||||||
|
{
|
||||||
|
get => _shakeResult;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_shakeResult = value;
|
||||||
|
instance.ApplyCameraValues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
camera's last transformation
|
camera's last transformation
|
||||||
**/
|
**/
|
||||||
private static Vector3 positionLast;
|
private static Vector3 positionLast;
|
||||||
private static Vector3 rotEluerLast;
|
private static Vector3 rotEulerLast;
|
||||||
private static Vector3 shakeLast;
|
private static Vector3 shakeLast;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,10 +81,46 @@ namespace HeavenStudio
|
||||||
to use in minigame scripts (Spaceball, Rhythm Rally, Built to Scale, etc.)
|
to use in minigame scripts (Spaceball, Rhythm Rally, Built to Scale, etc.)
|
||||||
and NOT in the editor
|
and NOT in the editor
|
||||||
**/
|
**/
|
||||||
public static Vector3 additionalPosition;
|
private static Vector3 _additionalPosition;
|
||||||
public static Vector3 additionalRotEluer;
|
public static Vector3 AdditionalPosition
|
||||||
public static Vector3 additionalScale;
|
{
|
||||||
public static float additionalFoV;
|
get => _additionalPosition;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_additionalPosition = value;
|
||||||
|
instance.ApplyCameraValues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static Vector3 _additionalRotEuler;
|
||||||
|
public static Vector3 AdditionalRotEuler
|
||||||
|
{
|
||||||
|
get => _additionalRotEuler;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_additionalRotEuler = value;
|
||||||
|
instance.ApplyCameraValues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static Vector3 _additionalScale;
|
||||||
|
public static Vector3 AdditionalScale
|
||||||
|
{
|
||||||
|
get => _additionalScale;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_additionalScale = value;
|
||||||
|
instance.ApplyCameraValues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static float _additionalFoV;
|
||||||
|
public static float AdditionalFoV
|
||||||
|
{
|
||||||
|
get => _additionalFoV;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_additionalFoV = value;
|
||||||
|
instance.ApplyCameraValues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Header("Components")]
|
[Header("Components")]
|
||||||
public Color baseColor;
|
public Color baseColor;
|
||||||
|
@ -80,7 +143,7 @@ namespace HeavenStudio
|
||||||
currentColor = baseColor;
|
currentColor = baseColor;
|
||||||
|
|
||||||
positionLast = defaultPosition;
|
positionLast = defaultPosition;
|
||||||
rotEluerLast = defaultRotEluer;
|
rotEulerLast = defaultRotEluer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnBeatChanged(double beat)
|
public void OnBeatChanged(double beat)
|
||||||
|
@ -90,7 +153,7 @@ namespace HeavenStudio
|
||||||
currentColor = baseColor;
|
currentColor = baseColor;
|
||||||
|
|
||||||
positionLast = defaultPosition;
|
positionLast = defaultPosition;
|
||||||
rotEluerLast = defaultRotEluer;
|
rotEulerLast = defaultRotEluer;
|
||||||
|
|
||||||
// this entire thing is a mess redo it later
|
// this entire thing is a mess redo it later
|
||||||
//pos
|
//pos
|
||||||
|
@ -127,15 +190,21 @@ namespace HeavenStudio
|
||||||
private void LateUpdate()
|
private void LateUpdate()
|
||||||
{
|
{
|
||||||
Camera cam = GetCamera();
|
Camera cam = GetCamera();
|
||||||
// rotate position by additional rotation
|
|
||||||
Vector3 userPos = Quaternion.Euler(additionalRotEluer) * position;
|
|
||||||
cam.transform.localPosition = userPos + additionalPosition + shakeResult;
|
|
||||||
cam.transform.eulerAngles = rotEluer + additionalRotEluer;
|
|
||||||
cam.fieldOfView = additionalFoV;
|
|
||||||
cam.backgroundColor = currentColor;
|
cam.backgroundColor = currentColor;
|
||||||
if (!StaticCamera.instance.usingMinigameAmbientColor) StaticCamera.instance.SetAmbientGlowColour(currentColor, false, false);
|
if (!StaticCamera.instance.usingMinigameAmbientColor) StaticCamera.instance.SetAmbientGlowColour(currentColor, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ApplyCameraValues()
|
||||||
|
{
|
||||||
|
Camera cam = GetCamera();
|
||||||
|
// rotate position by additional rotation
|
||||||
|
Vector3 userPos = Quaternion.Euler(_additionalRotEuler) * _position;
|
||||||
|
cam.transform.localPosition = userPos + _additionalPosition + _shakeResult;
|
||||||
|
cam.transform.eulerAngles = _rotEuler + _additionalRotEuler;
|
||||||
|
cam.fieldOfView = _additionalFoV;
|
||||||
|
//Debug.Log("Camera Pos: " + _additionalPosition);
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateCameraColor()
|
private void UpdateCameraColor()
|
||||||
{
|
{
|
||||||
foreach (var e in colorEvents)
|
foreach (var e in colorEvents)
|
||||||
|
@ -168,19 +237,19 @@ namespace HeavenStudio
|
||||||
switch (e["axis"])
|
switch (e["axis"])
|
||||||
{
|
{
|
||||||
case (int) CameraAxis.X:
|
case (int) CameraAxis.X:
|
||||||
position.x = func(positionLast.x, e["valA"], Mathf.Min(prog, 1f));
|
Position = new Vector3(func(positionLast.x, e["valA"], Mathf.Min(prog, 1f)), Position.y, Position.z);
|
||||||
break;
|
break;
|
||||||
case (int) CameraAxis.Y:
|
case (int) CameraAxis.Y:
|
||||||
position.y = func(positionLast.y, e["valB"], Mathf.Min(prog, 1f));
|
Position = new Vector3(Position.x, func(positionLast.y, e["valB"], Mathf.Min(prog, 1f)), Position.z);
|
||||||
break;
|
break;
|
||||||
case (int) CameraAxis.Z:
|
case (int) CameraAxis.Z:
|
||||||
position.z = func(positionLast.z, -e["valC"], Mathf.Min(prog, 1f));
|
Position = new Vector3(Position.x, Position.y, func(positionLast.z, -e["valC"], Mathf.Min(prog, 1f)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
float dx = func(positionLast.x, e["valA"], Mathf.Min(prog, 1f));
|
float dx = func(positionLast.x, e["valA"], Mathf.Min(prog, 1f));
|
||||||
float dy = func(positionLast.y, e["valB"], Mathf.Min(prog, 1f));
|
float dy = func(positionLast.y, e["valB"], Mathf.Min(prog, 1f));
|
||||||
float dz = func(positionLast.z, -e["valC"], Mathf.Min(prog, 1f));
|
float dz = func(positionLast.z, -e["valC"], Mathf.Min(prog, 1f));
|
||||||
position = new Vector3(dx, dy, dz);
|
Position = new Vector3(dx, dy, dz);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,19 +285,19 @@ namespace HeavenStudio
|
||||||
switch (e["axis"])
|
switch (e["axis"])
|
||||||
{
|
{
|
||||||
case (int) CameraAxis.X:
|
case (int) CameraAxis.X:
|
||||||
rotEluer.x = func(rotEluerLast.x, e["valA"], Mathf.Min(prog, 1f));
|
RotEuler = new Vector3(func(rotEulerLast.x, e["valA"], Mathf.Min(prog, 1f)), RotEuler.y, RotEuler.z);
|
||||||
break;
|
break;
|
||||||
case (int) CameraAxis.Y:
|
case (int) CameraAxis.Y:
|
||||||
rotEluer.y = func(rotEluerLast.y, e["valB"], Mathf.Min(prog, 1f));
|
RotEuler = new Vector3(RotEuler.x, func(rotEulerLast.y, e["valB"], Mathf.Min(prog, 1f)), RotEuler.z);
|
||||||
break;
|
break;
|
||||||
case (int) CameraAxis.Z:
|
case (int) CameraAxis.Z:
|
||||||
rotEluer.z = func(rotEluerLast.z, -e["valC"], Mathf.Min(prog, 1f));
|
RotEuler = new Vector3(RotEuler.x, RotEuler.y, func(rotEulerLast.z, -e["valC"], Mathf.Min(prog, 1f)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
float dx = func(rotEluerLast.x, e["valA"], Mathf.Min(prog, 1f));
|
float dx = func(rotEulerLast.x, e["valA"], Mathf.Min(prog, 1f));
|
||||||
float dy = func(rotEluerLast.y, e["valB"], Mathf.Min(prog, 1f));
|
float dy = func(rotEulerLast.y, e["valB"], Mathf.Min(prog, 1f));
|
||||||
float dz = func(rotEluerLast.z, -e["valC"], Mathf.Min(prog, 1f));
|
float dz = func(rotEulerLast.z, -e["valC"], Mathf.Min(prog, 1f));
|
||||||
rotEluer = new Vector3(dx, dy, dz); //I'm stupid and forgot to negate the rotation gfd 😢
|
RotEuler = new Vector3(dx, dy, dz); //I'm stupid and forgot to negate the rotation gfd 😢
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -237,19 +306,19 @@ namespace HeavenStudio
|
||||||
switch (e["axis"])
|
switch (e["axis"])
|
||||||
{
|
{
|
||||||
case (int) CameraAxis.X:
|
case (int) CameraAxis.X:
|
||||||
rotEluerLast.x = e["valA"];
|
rotEulerLast.x = e["valA"];
|
||||||
break;
|
break;
|
||||||
case (int) CameraAxis.Y:
|
case (int) CameraAxis.Y:
|
||||||
rotEluerLast.y = e["valB"];
|
rotEulerLast.y = e["valB"];
|
||||||
break;
|
break;
|
||||||
case (int) CameraAxis.Z:
|
case (int) CameraAxis.Z:
|
||||||
rotEluerLast.z = -e["valC"];
|
rotEulerLast.z = -e["valC"];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
rotEluerLast = new Vector3(e["valA"], e["valB"], -e["valC"]);
|
rotEulerLast = new Vector3(e["valA"], e["valB"], -e["valC"]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rotEluerLast = new Vector3(e["valA"], e["valB"], -e["valC"]);
|
rotEulerLast = new Vector3(e["valA"], e["valB"], -e["valC"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,27 +331,27 @@ namespace HeavenStudio
|
||||||
if (prog >= 0f)
|
if (prog >= 0f)
|
||||||
{
|
{
|
||||||
float fac = Mathf.Cos(Time.time * 80f) * 0.5f;
|
float fac = Mathf.Cos(Time.time * 80f) * 0.5f;
|
||||||
shakeResult = new Vector3(fac * e["valA"], fac * e["valB"]);
|
ShakeResult = new Vector3(fac * e["valA"], fac * e["valB"]);
|
||||||
}
|
}
|
||||||
if (prog > 1f)
|
if (prog > 1f)
|
||||||
{
|
{
|
||||||
shakeResult = new Vector3(0, 0);
|
ShakeResult = new Vector3(0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ResetTransforms()
|
public static void ResetTransforms()
|
||||||
{
|
{
|
||||||
position = defaultPosition;
|
Position = defaultPosition;
|
||||||
rotEluer = defaultRotEluer;
|
RotEuler = defaultRotEluer;
|
||||||
shakeResult = defaultShake;
|
ShakeResult = defaultShake;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ResetAdditionalTransforms()
|
public static void ResetAdditionalTransforms()
|
||||||
{
|
{
|
||||||
additionalPosition = new Vector3(0, 0, 0);
|
AdditionalPosition = new Vector3(0, 0, 0);
|
||||||
additionalRotEluer = new Vector3(0, 0, 0);
|
AdditionalRotEuler = new Vector3(0, 0, 0);
|
||||||
additionalFoV = defaultFoV;
|
AdditionalFoV = defaultFoV;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Camera GetCamera()
|
public static Camera GetCamera()
|
||||||
|
|
|
@ -605,7 +605,7 @@ namespace HeavenStudio
|
||||||
}
|
}
|
||||||
|
|
||||||
StartCoroutine(PlayCo(beat, delay));
|
StartCoroutine(PlayCo(beat, delay));
|
||||||
onBeatChanged?.Invoke(beat);
|
//onBeatChanged?.Invoke(beat);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator PlayCo(double beat, float delay = 0f)
|
private IEnumerator PlayCo(double beat, float delay = 0f)
|
||||||
|
@ -649,7 +649,7 @@ namespace HeavenStudio
|
||||||
|
|
||||||
Conductor.instance.Stop(beat);
|
Conductor.instance.Stop(beat);
|
||||||
SetCurrentEventToClosest(beat);
|
SetCurrentEventToClosest(beat);
|
||||||
onBeatChanged?.Invoke(beat);
|
//onBeatChanged?.Invoke(beat);
|
||||||
|
|
||||||
// I feel like I should standardize the names
|
// I feel like I should standardize the names
|
||||||
SkillStarManager.instance.KillStar();
|
SkillStarManager.instance.KillStar();
|
||||||
|
@ -946,6 +946,8 @@ namespace HeavenStudio
|
||||||
|
|
||||||
private void SetGame(string game, bool useMinigameColor = true)
|
private void SetGame(string game, bool useMinigameColor = true)
|
||||||
{
|
{
|
||||||
|
ResetCamera(); // resetting camera before setting new minigame so minigames can set camera values in their awake call - Rasmus
|
||||||
|
|
||||||
Destroy(currentGameO);
|
Destroy(currentGameO);
|
||||||
|
|
||||||
currentGameO = Instantiate(GetGame(game));
|
currentGameO = Instantiate(GetGame(game));
|
||||||
|
@ -953,8 +955,6 @@ namespace HeavenStudio
|
||||||
currentGameO.name = game;
|
currentGameO.name = game;
|
||||||
|
|
||||||
SetCurrentGame(game, useMinigameColor);
|
SetCurrentGame(game, useMinigameColor);
|
||||||
|
|
||||||
ResetCamera();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PreloadGameSequences(string game)
|
public void PreloadGameSequences(string game)
|
||||||
|
|
|
@ -431,7 +431,7 @@ namespace HeavenStudio.Games
|
||||||
if (shakeTween != null)
|
if (shakeTween != null)
|
||||||
shakeTween.Kill(true);
|
shakeTween.Kill(true);
|
||||||
|
|
||||||
DOTween.Punch(() => GameCamera.additionalPosition, x => GameCamera.additionalPosition = x, new Vector3(shakeIntensity, 0, 0),
|
DOTween.Punch(() => GameCamera.AdditionalPosition, x => GameCamera.AdditionalPosition = x, new Vector3(shakeIntensity, 0, 0),
|
||||||
Conductor.instance.pitchedSecPerBeat * 0.5f, 18, 1f);
|
Conductor.instance.pitchedSecPerBeat * 0.5f, 18, 1f);
|
||||||
executives[executiveCount - 1].Stop();
|
executives[executiveCount - 1].Stop();
|
||||||
assistantAnim.DoScaledAnimationAsync("Stop", 0.5f);
|
assistantAnim.DoScaledAnimationAsync("Stop", 0.5f);
|
||||||
|
|
|
@ -128,6 +128,10 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
|
GameCamera.AdditionalPosition = camPos.position + (Quaternion.Euler(camPos.eulerAngles) * Vector3.forward * 10f);
|
||||||
|
GameCamera.AdditionalRotEuler = camPos.eulerAngles;
|
||||||
|
GameCamera.AdditionalFoV = cameraFoV;
|
||||||
|
|
||||||
environmentMaterials = environmentRenderer.materials;
|
environmentMaterials = environmentRenderer.materials;
|
||||||
elevatorMaterials = elevatorRenderer.materials;
|
elevatorMaterials = elevatorRenderer.materials;
|
||||||
beltMaterial = Instantiate(environmentMaterials[8]);
|
beltMaterial = Instantiate(environmentMaterials[8]);
|
||||||
|
@ -191,13 +195,6 @@ namespace HeavenStudio.Games
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Start()
|
|
||||||
{
|
|
||||||
GameCamera.additionalPosition = camPos.position + (Quaternion.Euler(camPos.eulerAngles) * Vector3.forward * 10f);
|
|
||||||
GameCamera.additionalRotEluer = camPos.eulerAngles;
|
|
||||||
GameCamera.additionalFoV = cameraFoV;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateMappingColors(Color objectColor, Color shooterColor, Color environmentColor)
|
public void UpdateMappingColors(Color objectColor, Color shooterColor, Color environmentColor)
|
||||||
{
|
{
|
||||||
currentObjectColor = objectColor;
|
currentObjectColor = objectColor;
|
||||||
|
|
|
@ -290,39 +290,39 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
if (normalizedZoomOutAgainBeat > 1)
|
if (normalizedZoomOutAgainBeat > 1)
|
||||||
{
|
{
|
||||||
GameCamera.additionalPosition = new Vector3(0, 0, 0);
|
GameCamera.AdditionalPosition = new Vector3(0, 0, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseInOutQuint);
|
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseInOutQuint);
|
||||||
float newZoom = func(shouldDoSuccessZoom ? 4f : 1.5f, 0, normalizedZoomOutAgainBeat);
|
float newZoom = func(shouldDoSuccessZoom ? 4f : 1.5f, 0, normalizedZoomOutAgainBeat);
|
||||||
GameCamera.additionalPosition = new Vector3(0, 0, newZoom);
|
GameCamera.AdditionalPosition = new Vector3(0, 0, newZoom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (normalizedZoomInBeat >= 0)
|
else if (normalizedZoomInBeat >= 0)
|
||||||
{
|
{
|
||||||
if (normalizedZoomInBeat > 1)
|
if (normalizedZoomInBeat > 1)
|
||||||
{
|
{
|
||||||
GameCamera.additionalPosition = new Vector3(0, 0, shouldDoSuccessZoom ? 4f : 1.5f);
|
GameCamera.AdditionalPosition = new Vector3(0, 0, shouldDoSuccessZoom ? 4f : 1.5f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseOutQuint);
|
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseOutQuint);
|
||||||
float newZoom = func(-1, shouldDoSuccessZoom ? 4f : 1.5f, normalizedZoomInBeat);
|
float newZoom = func(-1, shouldDoSuccessZoom ? 4f : 1.5f, normalizedZoomInBeat);
|
||||||
GameCamera.additionalPosition = new Vector3(0, 0, newZoom);
|
GameCamera.AdditionalPosition = new Vector3(0, 0, newZoom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (normalizedZoomOutBeat >= 0)
|
else if (normalizedZoomOutBeat >= 0)
|
||||||
{
|
{
|
||||||
if (normalizedZoomOutBeat > 1)
|
if (normalizedZoomOutBeat > 1)
|
||||||
{
|
{
|
||||||
GameCamera.additionalPosition = new Vector3(0, 0, -1);
|
GameCamera.AdditionalPosition = new Vector3(0, 0, -1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseOutQuint);
|
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseOutQuint);
|
||||||
float newZoom = func(0f, 1f, normalizedZoomOutBeat);
|
float newZoom = func(0f, 1f, normalizedZoomOutBeat);
|
||||||
GameCamera.additionalPosition = new Vector3(0, 0, newZoom * -1);
|
GameCamera.AdditionalPosition = new Vector3(0, 0, newZoom * -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -425,7 +425,7 @@ namespace HeavenStudio.Games
|
||||||
if (shakeTween != null)
|
if (shakeTween != null)
|
||||||
shakeTween.Kill(true);
|
shakeTween.Kill(true);
|
||||||
|
|
||||||
DOTween.Punch(() => GameCamera.additionalPosition, x => GameCamera.additionalPosition = x, new Vector3(0, 0.75f, 0),
|
DOTween.Punch(() => GameCamera.AdditionalPosition, x => GameCamera.AdditionalPosition = x, new Vector3(0, 0.75f, 0),
|
||||||
Conductor.instance.pitchedSecPerBeat*0.5f, 18, 1f);
|
Conductor.instance.pitchedSecPerBeat*0.5f, 18, 1f);
|
||||||
|
|
||||||
isStepping = true;
|
isStepping = true;
|
||||||
|
|
|
@ -287,7 +287,7 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
currentXPos = flippersMovement.position.x + (moveLeft ? -rollDistance : rollDistance);
|
currentXPos = flippersMovement.position.x + (moveLeft ? -rollDistance : rollDistance);
|
||||||
isMoving = true;
|
isMoving = true;
|
||||||
currentCameraXPos = GameCamera.additionalPosition.x + (moveLeft ? -rollDistance : rollDistance);
|
currentCameraXPos = GameCamera.AdditionalPosition.x + (moveLeft ? -rollDistance : rollDistance);
|
||||||
if (moveLeft)
|
if (moveLeft)
|
||||||
{
|
{
|
||||||
rightSnow.Play();
|
rightSnow.Play();
|
||||||
|
@ -310,7 +310,7 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
EasingFunction.Function funcCam = EasingFunction.GetEasingFunction(EasingFunction.Ease.EaseInOutQuad);
|
EasingFunction.Function funcCam = EasingFunction.GetEasingFunction(EasingFunction.Ease.EaseInOutQuad);
|
||||||
float newCameraPosX = funcCam(lastCameraXPos, currentCameraXPos, normalizedCamBeat);
|
float newCameraPosX = funcCam(lastCameraXPos, currentCameraXPos, normalizedCamBeat);
|
||||||
GameCamera.additionalPosition = new Vector3(newCameraPosX, 0, 0);
|
GameCamera.AdditionalPosition = new Vector3(newCameraPosX, 0, 0);
|
||||||
}
|
}
|
||||||
if (1f >= normalizedBeat)
|
if (1f >= normalizedBeat)
|
||||||
{
|
{
|
||||||
|
|
|
@ -839,7 +839,7 @@ namespace HeavenStudio.Games
|
||||||
}
|
}
|
||||||
|
|
||||||
BackgroundColorUpdate();
|
BackgroundColorUpdate();
|
||||||
GameCamera.additionalPosition = cameraPosition - GameCamera.defaultPosition;
|
GameCamera.AdditionalPosition = cameraPosition - GameCamera.defaultPosition;
|
||||||
BGEffect.transform.position = new Vector3(GameCamera.instance.transform.position.x, GameCamera.instance.transform.position.y, 0);
|
BGEffect.transform.position = new Vector3(GameCamera.instance.transform.position.x, GameCamera.instance.transform.position.y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -392,7 +392,7 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
public void SetZoom(int zoom)
|
public void SetZoom(int zoom)
|
||||||
{
|
{
|
||||||
GameCamera.additionalPosition = new Vector3(0, 0, (ZoomPresets)zoom switch
|
GameCamera.AdditionalPosition = new Vector3(0, 0, (ZoomPresets)zoom switch
|
||||||
{
|
{
|
||||||
ZoomPresets.Regular => 0,
|
ZoomPresets.Regular => 0,
|
||||||
ZoomPresets.NotThatFar => -4.5f,
|
ZoomPresets.NotThatFar => -4.5f,
|
||||||
|
|
|
@ -159,6 +159,9 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
|
GameCamera.AdditionalPosition = cameraPos.position + (Quaternion.Euler(cameraPos.rotation.eulerAngles) * Vector3.forward * 10f);
|
||||||
|
GameCamera.AdditionalRotEuler = cameraPos.rotation.eulerAngles;
|
||||||
|
GameCamera.AdditionalFoV = cameraFOV;
|
||||||
instance = this;
|
instance = this;
|
||||||
paddlers.Init();
|
paddlers.Init();
|
||||||
|
|
||||||
|
@ -367,9 +370,9 @@ namespace HeavenStudio.Games
|
||||||
opponentServing = false;
|
opponentServing = false;
|
||||||
|
|
||||||
//update camera
|
//update camera
|
||||||
GameCamera.additionalPosition = cameraPos.position + (Quaternion.Euler(cameraPos.rotation.eulerAngles) * Vector3.forward * 10f);
|
GameCamera.AdditionalPosition = cameraPos.position + (Quaternion.Euler(cameraPos.rotation.eulerAngles) * Vector3.forward * 10f);
|
||||||
GameCamera.additionalRotEluer = cameraPos.rotation.eulerAngles;
|
GameCamera.AdditionalRotEuler = cameraPos.rotation.eulerAngles;
|
||||||
GameCamera.additionalFoV = cameraFOV;
|
GameCamera.AdditionalFoV = cameraFOV;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Bop(double beat, float length, bool bop, bool bopAuto)
|
public void Bop(double beat, float length, bool bop, bool bopAuto)
|
||||||
|
|
|
@ -293,11 +293,11 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
if (normalizedShouldStopBeat > 1 && !keepZoomOut)
|
if (normalizedShouldStopBeat > 1 && !keepZoomOut)
|
||||||
{
|
{
|
||||||
GameCamera.additionalPosition = new Vector3(0, 0, 0);
|
GameCamera.AdditionalPosition = new Vector3(0, 0, 0);
|
||||||
}
|
}
|
||||||
else if (normalizedBeat > 1)
|
else if (normalizedBeat > 1)
|
||||||
{
|
{
|
||||||
GameCamera.additionalPosition = new Vector3(currentCamPos.x, currentCamPos.y, currentCamPos.z + 10);
|
GameCamera.AdditionalPosition = new Vector3(currentCamPos.x, currentCamPos.y, currentCamPos.z + 10);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -305,7 +305,7 @@ namespace HeavenStudio.Games
|
||||||
float newPosX = func(lastCamPos.x, currentCamPos.x, normalizedBeat);
|
float newPosX = func(lastCamPos.x, currentCamPos.x, normalizedBeat);
|
||||||
float newPosY = func(lastCamPos.y, currentCamPos.y, normalizedBeat);
|
float newPosY = func(lastCamPos.y, currentCamPos.y, normalizedBeat);
|
||||||
float newPosZ = func(lastCamPos.z + 10, currentCamPos.z + 10, normalizedBeat);
|
float newPosZ = func(lastCamPos.z + 10, currentCamPos.z + 10, normalizedBeat);
|
||||||
GameCamera.additionalPosition = new Vector3(newPosX, newPosY, newPosZ);
|
GameCamera.AdditionalPosition = new Vector3(newPosX, newPosY, newPosZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -670,7 +670,7 @@ namespace HeavenStudio.Games
|
||||||
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseInOutQuad);
|
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(Util.EasingFunction.Ease.EaseInOutQuad);
|
||||||
|
|
||||||
float newX = func(lastTargetCameraX, targetCameraX, normalizedBeat);
|
float newX = func(lastTargetCameraX, targetCameraX, normalizedBeat);
|
||||||
GameCamera.additionalPosition = new Vector3(newX, 0, 0);
|
GameCamera.AdditionalPosition = new Vector3(newX, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -680,7 +680,7 @@ namespace HeavenStudio.Games
|
||||||
SoundByte.PlayOneShotGame("rockers/lastOne");
|
SoundByte.PlayOneShotGame("rockers/lastOne");
|
||||||
if (moveCamera)
|
if (moveCamera)
|
||||||
{
|
{
|
||||||
lastTargetCameraX = GameCamera.additionalPosition.x;
|
lastTargetCameraX = GameCamera.AdditionalPosition.x;
|
||||||
targetCameraX = 0;
|
targetCameraX = 0;
|
||||||
cameraMoveBeat = beat + 2;
|
cameraMoveBeat = beat + 2;
|
||||||
}
|
}
|
||||||
|
@ -736,7 +736,7 @@ namespace HeavenStudio.Games
|
||||||
SoundByte.PlayOneShotGame("rockers/cmon");
|
SoundByte.PlayOneShotGame("rockers/cmon");
|
||||||
if (moveCamera)
|
if (moveCamera)
|
||||||
{
|
{
|
||||||
lastTargetCameraX = GameCamera.additionalPosition.x;
|
lastTargetCameraX = GameCamera.AdditionalPosition.x;
|
||||||
targetCameraX = 0;
|
targetCameraX = 0;
|
||||||
cameraMoveBeat = beat + 2;
|
cameraMoveBeat = beat + 2;
|
||||||
}
|
}
|
||||||
|
@ -806,7 +806,7 @@ namespace HeavenStudio.Games
|
||||||
List<BeatAction.Action> actions = new List<BeatAction.Action>();
|
List<BeatAction.Action> actions = new List<BeatAction.Action>();
|
||||||
if (moveCamera)
|
if (moveCamera)
|
||||||
{
|
{
|
||||||
lastTargetCameraX = GameCamera.additionalPosition.x;
|
lastTargetCameraX = GameCamera.AdditionalPosition.x;
|
||||||
targetCameraX = 0;
|
targetCameraX = 0;
|
||||||
cameraMoveBeat = beat + goToMiddleBeat;
|
cameraMoveBeat = beat + goToMiddleBeat;
|
||||||
}
|
}
|
||||||
|
@ -896,7 +896,7 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
private void MoveCamera(double beat)
|
private void MoveCamera(double beat)
|
||||||
{
|
{
|
||||||
lastTargetCameraX = GameCamera.additionalPosition.x;
|
lastTargetCameraX = GameCamera.AdditionalPosition.x;
|
||||||
targetCameraX = JJ.transform.localPosition.x;
|
targetCameraX = JJ.transform.localPosition.x;
|
||||||
cameraMoveBeat = beat;
|
cameraMoveBeat = beat;
|
||||||
|
|
||||||
|
@ -1058,7 +1058,7 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
if (moveCamera)
|
if (moveCamera)
|
||||||
{
|
{
|
||||||
lastTargetCameraX = GameCamera.additionalPosition.x;
|
lastTargetCameraX = GameCamera.AdditionalPosition.x;
|
||||||
targetCameraX = Soshi.transform.localPosition.x;
|
targetCameraX = Soshi.transform.localPosition.x;
|
||||||
cameraMoveBeat = beat - 1;
|
cameraMoveBeat = beat - 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ namespace HeavenStudio.Games.Scripts_SeeSaw
|
||||||
public void Land(LandType landType, bool getUpOut)
|
public void Land(LandType landType, bool getUpOut)
|
||||||
{
|
{
|
||||||
transform.rotation = Quaternion.Euler(0, 0, 0);
|
transform.rotation = Quaternion.Euler(0, 0, 0);
|
||||||
GameCamera.additionalPosition = Vector3.zero;
|
GameCamera.AdditionalPosition = Vector3.zero;
|
||||||
bool landedOut = false;
|
bool landedOut = false;
|
||||||
switch (currentState)
|
switch (currentState)
|
||||||
{
|
{
|
||||||
|
|
|
@ -165,27 +165,27 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
if (normalizedBeat > 1)
|
if (normalizedBeat > 1)
|
||||||
{
|
{
|
||||||
GameCamera.additionalPosition = new Vector3(0, 0, currentZoomCamDistance + 10);
|
GameCamera.AdditionalPosition = new Vector3(0, 0, currentZoomCamDistance + 10);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (currentZoomCamLength < 0)
|
if (currentZoomCamLength < 0)
|
||||||
{
|
{
|
||||||
GameCamera.additionalPosition = new Vector3(0, 0, currentZoomCamDistance + 10);
|
GameCamera.AdditionalPosition = new Vector3(0, 0, currentZoomCamDistance + 10);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastEase);
|
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastEase);
|
||||||
|
|
||||||
float newPosZ = func(lastCamDistance + 10, currentZoomCamDistance + 10, normalizedBeat);
|
float newPosZ = func(lastCamDistance + 10, currentZoomCamDistance + 10, normalizedBeat);
|
||||||
GameCamera.additionalPosition = new Vector3(0, 0, newPosZ);
|
GameCamera.AdditionalPosition = new Vector3(0, 0, newPosZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// ?
|
// ?
|
||||||
GameCamera.additionalPosition = new Vector3(0, 0, 0);
|
GameCamera.AdditionalPosition = new Vector3(0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,19 +281,19 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
if (!keepZoomOut)
|
if (!keepZoomOut)
|
||||||
{
|
{
|
||||||
GameCamera.additionalPosition = new Vector3(0, 0, 0);
|
GameCamera.AdditionalPosition = new Vector3(0, 0, 0);
|
||||||
zoomOutAnim.Play("NoZoomOut", 0, 0);
|
zoomOutAnim.Play("NoZoomOut", 0, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastEase);
|
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastEase);
|
||||||
if (normalizedBeat > 1)
|
if (normalizedBeat > 1)
|
||||||
GameCamera.additionalPosition = new Vector3(0, 30, -100);
|
GameCamera.AdditionalPosition = new Vector3(0, 30, -100);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float newPosY = func(0, 30, normalizedBeat);
|
float newPosY = func(0, 30, normalizedBeat);
|
||||||
float newPosZ = func(0, -100, normalizedBeat);
|
float newPosZ = func(0, -100, normalizedBeat);
|
||||||
GameCamera.additionalPosition = new Vector3(0, newPosY, newPosZ);
|
GameCamera.AdditionalPosition = new Vector3(0, newPosY, newPosZ);
|
||||||
}
|
}
|
||||||
if (normalizedAnimBeat > 1)
|
if (normalizedAnimBeat > 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace HeavenStudio.Games.Scripts_TapTroupe
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
transform.localPosition = new Vector3(transform.localPosition.x, GameCamera.additionalPosition.y + yOffset, GameCamera.additionalPosition.z + zoomOffset);
|
transform.localPosition = new Vector3(transform.localPosition.x, GameCamera.AdditionalPosition.y + yOffset, GameCamera.AdditionalPosition.z + zoomOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,10 @@ namespace HeavenStudio
|
||||||
UpdatePan();
|
UpdatePan();
|
||||||
UpdateRotation();
|
UpdateRotation();
|
||||||
UpdateScale();
|
UpdateScale();
|
||||||
|
|
||||||
|
canvas.localPosition = pan;
|
||||||
|
canvas.eulerAngles = new Vector3(0, 0, rotation);
|
||||||
|
canvas.localScale = scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
|
Loading…
Reference in a new issue