Raccoon animation and scene changes #415

Merged
glencelow merged 16 commits from PlayerController into main 2023-03-10 17:28:16 +08:00
4 changed files with 45 additions and 26 deletions
Showing only changes of commit 66026ff926 - Show all commits

View File

@ -3667,6 +3667,8 @@
Scripts: Scripts:
- Type: JumpPad - Type: JumpPad
Enabled: true Enabled: true
scaleYMaxSize: 2
scaleDuration: 0.25
- EID: 172 - EID: 172
Name: BouncyPlatform Name: BouncyPlatform
IsActive: true IsActive: true
@ -3696,6 +3698,8 @@
Scripts: Scripts:
- Type: JumpPad - Type: JumpPad
Enabled: true Enabled: true
scaleYMaxSize: 2
scaleDuration: 0.25
- EID: 173 - EID: 173
Name: BouncyPlatform Name: BouncyPlatform
IsActive: true IsActive: true
@ -3725,6 +3729,8 @@
Scripts: Scripts:
- Type: JumpPad - Type: JumpPad
Enabled: true Enabled: true
scaleYMaxSize: 2
scaleDuration: 0.25
- EID: 174 - EID: 174
Name: BouncyPlatform Name: BouncyPlatform
IsActive: true IsActive: true
@ -3754,6 +3760,8 @@
Scripts: Scripts:
- Type: JumpPad - Type: JumpPad
Enabled: true Enabled: true
scaleYMaxSize: 2
scaleDuration: 0.25
- EID: 176 - EID: 176
Name: KitchenetteCounter Name: KitchenetteCounter
IsActive: true IsActive: true
@ -5790,7 +5798,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: ~ Components: ~
Scripts: Scripts:
- Type: SHADE_Scripting.UI.TweenManager - Type: TweenManager
Enabled: true Enabled: true
- EID: 551 - EID: 551
Name: TransitionCanvas Name: TransitionCanvas

View File

@ -6,16 +6,19 @@ using System;
public class JumpPad : Script public class JumpPad : Script
{ {
private Transform tran; private Transform tran;
private float defaultScale; private Vector3 defaultScale;
public float scaleMaxSize = 2.0f; public float scaleYMaxSize = 2.0f;
private float scaleXZMaxSize;
public float scaleDuration = 0.25f; public float scaleDuration = 0.25f;
private bool landed = false; private bool landed = false;
private bool scaleUpDone = false; private bool scaleUpDone = false;
[NonSerialized] [NonSerialized]
private TweenThread scaleUp; private TweenThread scaleYUp;
[NonSerialized] [NonSerialized]
private TweenThread scaleDown; private TweenThread scaleXZUp;
[NonSerialized]
private TweenThreadVec3 scaleDown;
protected override void awake() protected override void awake()
{ {
@ -25,31 +28,32 @@ public class JumpPad : Script
if (!tran) if (!tran)
Debug.LogError("NO TRANSFORM"); Debug.LogError("NO TRANSFORM");
defaultScale = tran.LocalScale.y; defaultScale = tran.LocalScale;
scaleXZMaxSize = scaleYMaxSize * 0.3f;
} }
protected override void start() protected override void start()
{ {
scaleUp = TweenManager.CreateTweenThread(scaleDuration, tran.LocalScale.y, scaleMaxSize, EASING_METHOD.EASE_IN_SINE); scaleYUp = TweenManager.CreateTweenThread(scaleDuration, tran.LocalScale.y, scaleYMaxSize, EASING_METHOD.EASE_IN_SINE);
scaleDown = TweenManager.CreateTweenThread(scaleDuration, tran.LocalScale.y, defaultScale, EASING_METHOD.EASE_IN_SINE); scaleXZUp = TweenManager.CreateTweenThread(scaleDuration, tran.LocalScale.y, scaleXZMaxSize, EASING_METHOD.EASE_IN_SINE);
} }
protected override void update() protected override void update()
{ {
if (landed && tran) if (landed && tran)
{ {
tran.LocalScale = new Vector3(tran.LocalScale.x, scaleUp.GetValue(), tran.LocalScale.z); tran.LocalScale = new Vector3(scaleXZUp.GetValue(), scaleYUp.GetValue(), scaleXZUp.GetValue());
if (scaleUp.IsCompleted()) if (scaleYUp.IsCompleted() && scaleXZUp.IsCompleted())
{ {
landed = false; landed = false;
scaleUpDone = true; scaleUpDone = true;
scaleDown.Reset(); scaleDown = TweenManager.CreateTweenThreadVec3(scaleDuration, tran.LocalScale, defaultScale, EASING_METHOD.EASE_IN_SINE);
} }
} }
if (scaleUpDone && !landed) if (scaleUpDone && !landed)
{ {
tran.LocalScale = new Vector3(tran.LocalScale.x, scaleDown.GetValue(), tran.LocalScale.z); tran.LocalScale = scaleDown.GetValue();
if (scaleDown.IsCompleted()) if (scaleDown.IsCompleted())
{ {
scaleUpDone = false; scaleUpDone = false;
@ -66,7 +70,8 @@ public class JumpPad : Script
AudioHandler.audioClipHandlers["SFXJumpPad"].Play(); AudioHandler.audioClipHandlers["SFXJumpPad"].Play();
info.GameObject.GetScript<PlayerController>().landedOnJumpPad = true; info.GameObject.GetScript<PlayerController>().landedOnJumpPad = true;
landed = true; landed = true;
scaleUp.Reset(); scaleYUp.Reset();
scaleXZUp.Reset();
} }
} }

View File

@ -40,11 +40,6 @@ namespace SHADE_Scripting.UI
if (listOfCamera.Count == 0) if (listOfCamera.Count == 0)
Debug.LogError("EMPTY PREVIEW POINTS"); Debug.LogError("EMPTY PREVIEW POINTS");
moveToEndPoint1 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[0].GetComponent<Transform>().LocalPosition, endPoint1, EASING_METHOD.EASE_IN_SINE);
moveToEndPoint2 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[1].GetComponent<Transform>().LocalPosition, endPoint2, EASING_METHOD.EASE_IN_SINE);
moveToEndPoint3 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[2].GetComponent<Transform>().LocalPosition, endPoint3, EASING_METHOD.EASE_IN_SINE);
} }
protected override void start() protected override void start()
@ -52,6 +47,11 @@ namespace SHADE_Scripting.UI
if (gameplayCanvas) if (gameplayCanvas)
gameplayCanvas.SetActive(false); gameplayCanvas.SetActive(false);
listOfCamera[0].SetMainCamera(); listOfCamera[0].SetMainCamera();
moveToEndPoint1 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[0].GetComponent<Transform>().LocalPosition, endPoint1, EASING_METHOD.EASE_IN_SINE);
moveToEndPoint2 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[1].GetComponent<Transform>().LocalPosition, endPoint2, EASING_METHOD.EASE_IN_SINE);
moveToEndPoint3 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[2].GetComponent<Transform>().LocalPosition, endPoint3, EASING_METHOD.EASE_IN_SINE);
} }
protected override void update() protected override void update()
@ -135,7 +135,7 @@ namespace SHADE_Scripting.UI
{ {
if (reset3) if (reset3)
{ {
moveToEndPoint3 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[2].GetComponent<Transform>().LocalPosition, endPoint3, EASING_METHOD.EASE_IN_SINE); moveToEndPoint3.Reset();
reset3 = false; reset3 = false;
} }
listOfCamera[2].GetComponent<Transform>().LocalPosition = moveToEndPoint3.GetValue(); listOfCamera[2].GetComponent<Transform>().LocalPosition = moveToEndPoint3.GetValue();

View File

@ -53,13 +53,16 @@ namespace SHADE_Scripting.UI
{ {
if (!GameManager.Instance.PreviewLevelDone) if (!GameManager.Instance.PreviewLevelDone)
{ {
rot.Reset(); if (rot != null && scaleX != null && scaleY != null)
scaleX.Reset(); {
scaleY.Reset(); rot.Reset();
scaleX.Reset();
scaleY.Reset();
}
return; return;
} }
if (!popInDone) if (!popInDone && rot != null && scaleX != null && scaleY != null)
{ {
tran.LocalEulerAngles = new Vector3(0.0f, 0.0f, SHADE.Math.DegreesToRadians(rot.GetValue())); tran.LocalEulerAngles = new Vector3(0.0f, 0.0f, SHADE.Math.DegreesToRadians(rot.GetValue()));
tran.LocalScale = new Vector3(scaleX.GetValue(), scaleY.GetValue(), 1); tran.LocalScale = new Vector3(scaleX.GetValue(), scaleY.GetValue(), 1);
@ -71,7 +74,7 @@ namespace SHADE_Scripting.UI
stayDone = true; stayDone = true;
} }
if (rot.IsCompleted() && scaleX.IsCompleted() && scaleY.IsCompleted()) if (rot != null && scaleX != null && scaleY != null && rot.IsCompleted() && scaleX.IsCompleted() && scaleY.IsCompleted())
popInDone = true; popInDone = true;
if (stayDone) if (stayDone)
@ -82,8 +85,11 @@ namespace SHADE_Scripting.UI
scaleOutY = TweenManager.CreateTweenThread(popOutDuration, scaleAmtY, 0, EASING_METHOD.EASE_IN_SINE); scaleOutY = TweenManager.CreateTweenThread(popOutDuration, scaleAmtY, 0, EASING_METHOD.EASE_IN_SINE);
createThreadOnce = false; createThreadOnce = false;
} }
tran.LocalScale = new Vector3(scaleOutX.GetValue(), scaleOutY.GetValue(), 1);
if (scaleOutX.IsCompleted() && scaleOutY.IsCompleted()) if(scaleOutX != null && scaleOutY != null)
tran.LocalScale = new Vector3(scaleOutX.GetValue(), scaleOutY.GetValue(), 1);
if (scaleOutX != null && scaleOutY != null && scaleOutX.IsCompleted() && scaleOutY.IsCompleted())
{ {
GameObject.SetActive(false); GameObject.SetActive(false);
GameManager.Instance.stealFoodPopUpDone = true; GameManager.Instance.stealFoodPopUpDone = true;