Bug fixes, Scene changes and new features #376
|
@ -5255,14 +5255,14 @@
|
|||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 460
|
||||
Name: RetryButton
|
||||
Name: StealFoodLogo
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: -100, z: 0}
|
||||
Translate: {x: 0, y: 0, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 300, y: 300, z: 500}
|
||||
Scale: {x: 0, y: 0, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
|
@ -5273,4 +5273,20 @@
|
|||
Hovered: false
|
||||
Clicked: false
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
Scripts:
|
||||
- Type: SHADE_Scripting.UI.StealFoodPopUp
|
||||
Enabled: true
|
||||
popInDuration: 0.5
|
||||
popOutDuration: 0.5
|
||||
stayDuration: 1
|
||||
rotationAmt: 1800
|
||||
scaleAmtX: 538
|
||||
scaleAmtY: 377
|
||||
- EID: 463
|
||||
Name: TweenManager
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components: ~
|
||||
Scripts:
|
||||
- Type: SHADE_Scripting.UI.TweenManager
|
||||
Enabled: true
|
|
@ -0,0 +1,90 @@
|
|||
using System;
|
||||
using SHADE;
|
||||
|
||||
namespace SHADE_Scripting.UI
|
||||
{
|
||||
public class StealFoodPopUp : Script
|
||||
{
|
||||
[NonSerialized]
|
||||
private TweenThread rot;
|
||||
[NonSerialized]
|
||||
private TweenThread scaleX;
|
||||
[NonSerialized]
|
||||
private TweenThread scaleY;
|
||||
[NonSerialized]
|
||||
private TweenThread scaleOutX;
|
||||
[NonSerialized]
|
||||
private TweenThread scaleOutY;
|
||||
|
||||
private Transform tran;
|
||||
|
||||
public float popInDuration = 0.3f;
|
||||
public float popOutDuration = 0.3f;
|
||||
public float stayDuration = 1.0f;
|
||||
public float rotationAmt = 1800;
|
||||
public float scaleAmtX = 538;
|
||||
public float scaleAmtY = 377;
|
||||
|
||||
private bool popInDone = false;
|
||||
private bool stayDone = false;
|
||||
|
||||
private bool createThreadOnce = true;
|
||||
|
||||
private float timer = 0;
|
||||
|
||||
protected override void start()
|
||||
{
|
||||
rot = TweenManager.CreateTweenThread(popInDuration, 0, rotationAmt, EASING_METHOD.EASE_IN_SINE);
|
||||
scaleX = TweenManager.CreateTweenThread(popInDuration, 0, scaleAmtX, EASING_METHOD.EASE_IN_SINE);
|
||||
scaleY = TweenManager.CreateTweenThread(popInDuration, 0, scaleAmtY, EASING_METHOD.EASE_IN_SINE);
|
||||
|
||||
tran = GetComponent<Transform>();
|
||||
if (!tran)
|
||||
Debug.LogError("Missing Transform");
|
||||
else
|
||||
{
|
||||
tran.LocalScale = new Vector3(0.0f,0.0f,1.0f);
|
||||
tran.LocalEulerAngles = new Vector3(0.0f,0.0f,0.0f);
|
||||
}
|
||||
|
||||
}
|
||||
//538x377
|
||||
protected override void update()
|
||||
{
|
||||
|
||||
if (!popInDone)
|
||||
{
|
||||
tran.LocalEulerAngles = new Vector3(0.0f, 0.0f, SHADE.Math.DegreesToRadians(rot.GetValue()));
|
||||
tran.LocalScale = new Vector3(scaleX.GetValue(), scaleY.GetValue(), 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
timer += Time.DeltaTimeF;
|
||||
if (timer >= stayDuration)
|
||||
stayDone = true;
|
||||
}
|
||||
|
||||
if (rot.IsCompleted() && scaleX.IsCompleted() && scaleY.IsCompleted())
|
||||
popInDone = true;
|
||||
|
||||
if (stayDone)
|
||||
{
|
||||
if (createThreadOnce)
|
||||
{
|
||||
scaleOutX = TweenManager.CreateTweenThread(popOutDuration, scaleAmtX, 0, EASING_METHOD.EASE_IN_SINE);
|
||||
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())
|
||||
{
|
||||
GameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
Name: SC_StealFoodPopUp
|
||||
ID: 159004097
|
||||
Type: 9
|
|
@ -28,10 +28,11 @@ namespace SHADE_Scripting.UI
|
|||
|
||||
public void Update(float deltaTime)
|
||||
{
|
||||
if (timer > duration)
|
||||
if (timer >= duration)
|
||||
return;
|
||||
|
||||
timer += deltaTime;
|
||||
if (timer > duration)
|
||||
if (timer >= duration)
|
||||
timer = duration;
|
||||
|
||||
value = EasingHelper.EaseHelp(timer/duration, method) * (endValue - startValue) + startValue ;
|
||||
|
@ -96,7 +97,6 @@ namespace SHADE_Scripting.UI
|
|||
|
||||
protected override void update()
|
||||
{
|
||||
|
||||
foreach (TweenThread thread in threadList)
|
||||
{
|
||||
thread.Update(Time.DeltaTimeF);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "Physics/Interface/SHColliderComponent.h"
|
||||
#include "Graphics/MiddleEnd/Lights/SHLightComponent.h"
|
||||
#include "Graphics/MiddleEnd/TextRendering/SHTextRenderableComponent.h"
|
||||
#include "FRC/SHFramerateController.h"
|
||||
|
||||
#include "Assets/SHAssetManager.h"
|
||||
#include "Camera/SHCameraComponent.h"
|
||||
|
@ -43,6 +44,7 @@ namespace Sandbox
|
|||
void SBMainScene::Init()
|
||||
{
|
||||
sceneName = SHSerialization::DeserializeSceneFromFile(sceneAssetID);
|
||||
SHFrameRateController::ResetDT();
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* TESTING CODE */
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "SHEditorWidgets.hpp"
|
||||
|
||||
#include "Math/Transform/SHTransformSystem.h"
|
||||
|
||||
#include "FRC/SHFramerateController.h"
|
||||
//#==============================================================#
|
||||
//|| Editor Window Includes ||
|
||||
//#==============================================================#
|
||||
|
@ -612,6 +612,7 @@ namespace SHADE
|
|||
editorState = State::PLAY;
|
||||
SHCommandManager::SwapStacks();
|
||||
SHEventManager::BroadcastEvent<SHEditorStateChangeEvent>(STATE_CHANGE_EVENT, SH_EDITOR_ON_PLAY_EVENT);
|
||||
SHFrameRateController::ResetDT();
|
||||
}
|
||||
else if (editorState == State::PAUSE)
|
||||
{
|
||||
|
|
|
@ -32,6 +32,11 @@ namespace SHADE
|
|||
rawDeltaTime = deltaTime.count();
|
||||
elapsedTime += rawDeltaTime;
|
||||
}
|
||||
|
||||
void SHFrameRateController::ResetDT() noexcept
|
||||
{
|
||||
prevFrameTime = std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
}
|
||||
|
||||
//TODO Legacy code. Delete soon
|
||||
|
|
|
@ -43,6 +43,8 @@ namespace SHADE
|
|||
//Updates the raw delta time accordingly
|
||||
static void UpdateFRC() noexcept;
|
||||
|
||||
static void ResetDT() noexcept;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue