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

View File

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

View File

@ -40,11 +40,6 @@ namespace SHADE_Scripting.UI
if (listOfCamera.Count == 0)
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()
@ -52,6 +47,11 @@ namespace SHADE_Scripting.UI
if (gameplayCanvas)
gameplayCanvas.SetActive(false);
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()
@ -135,7 +135,7 @@ namespace SHADE_Scripting.UI
{
if (reset3)
{
moveToEndPoint3 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[2].GetComponent<Transform>().LocalPosition, endPoint3, EASING_METHOD.EASE_IN_SINE);
moveToEndPoint3.Reset();
reset3 = false;
}
listOfCamera[2].GetComponent<Transform>().LocalPosition = moveToEndPoint3.GetValue();

View File

@ -53,13 +53,16 @@ namespace SHADE_Scripting.UI
{
if (!GameManager.Instance.PreviewLevelDone)
{
rot.Reset();
scaleX.Reset();
scaleY.Reset();
if (rot != null && scaleX != null && scaleY != null)
{
rot.Reset();
scaleX.Reset();
scaleY.Reset();
}
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.LocalScale = new Vector3(scaleX.GetValue(), scaleY.GetValue(), 1);
@ -71,7 +74,7 @@ namespace SHADE_Scripting.UI
stayDone = true;
}
if (rot.IsCompleted() && scaleX.IsCompleted() && scaleY.IsCompleted())
if (rot != null && scaleX != null && scaleY != null && rot.IsCompleted() && scaleX.IsCompleted() && scaleY.IsCompleted())
popInDone = true;
if (stayDone)
@ -82,8 +85,11 @@ namespace SHADE_Scripting.UI
scaleOutY = TweenManager.CreateTweenThread(popOutDuration, scaleAmtY, 0, EASING_METHOD.EASE_IN_SINE);
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);
GameManager.Instance.stealFoodPopUpDone = true;