Merge branch 'main' into SP3-1-Rendering
This commit is contained in:
commit
683ce6146a
File diff suppressed because it is too large
Load Diff
|
@ -3071,13 +3071,14 @@
|
||||||
Collider Component:
|
Collider Component:
|
||||||
Colliders:
|
Colliders:
|
||||||
- Is Trigger: false
|
- Is Trigger: false
|
||||||
Collision Tag: 0
|
Collision Tag: 1
|
||||||
Type: Box
|
Type: Capsule
|
||||||
Half Extents: {x: 0.400000006, y: 0.5, z: 0.300000012}
|
Radius: 0.300000012
|
||||||
|
Height: 0.300000012
|
||||||
Friction: 0.400000006
|
Friction: 0.400000006
|
||||||
Bounciness: 0
|
Bounciness: 0
|
||||||
Density: 1
|
Density: 1
|
||||||
Position Offset: {x: 0, y: 0.25, z: 0}
|
Position Offset: {x: 0, y: 0.300000012, z: 0}
|
||||||
Rotation Offset: {x: 0, y: 0, z: 0}
|
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts:
|
Scripts:
|
||||||
|
@ -3107,8 +3108,6 @@
|
||||||
throwItem: false
|
throwItem: false
|
||||||
rayDistance: 0.75
|
rayDistance: 0.75
|
||||||
rayHeight: 0.100000001
|
rayHeight: 0.100000001
|
||||||
aimingFOV: 50
|
|
||||||
defaultFOV: 45
|
|
||||||
- EID: 3
|
- EID: 3
|
||||||
Name: HoldingPoint
|
Name: HoldingPoint
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -14094,9 +14093,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
NumberOfChildren: 0
|
NumberOfChildren: 0
|
||||||
Components: ~
|
Components: ~
|
||||||
Scripts:
|
Scripts: ~
|
||||||
- Type: SHADE_Scripting.UI.TweenManager
|
|
||||||
Enabled: true
|
|
||||||
- EID: 549
|
- EID: 549
|
||||||
Name: StealFoodCanvas
|
Name: StealFoodCanvas
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -14178,7 +14175,7 @@
|
||||||
NumberOfChildren: 0
|
NumberOfChildren: 0
|
||||||
Components: ~
|
Components: ~
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: SHADE_Scripting.UI.TweenManager
|
- Type: TweenManager
|
||||||
Enabled: true
|
Enabled: true
|
||||||
- EID: 554
|
- EID: 554
|
||||||
Name: CameraPoints
|
Name: CameraPoints
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,6 +10,7 @@
|
||||||
Color: {x: 1, y: 1, z: 1, w: 1}
|
Color: {x: 1, y: 1, z: 1, w: 1}
|
||||||
Layer: 4294967295
|
Layer: 4294967295
|
||||||
Strength: 0
|
Strength: 0
|
||||||
|
Casting Shadows: false
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 1
|
- EID: 1
|
||||||
|
@ -152,7 +153,7 @@
|
||||||
NumberOfChildren: 0
|
NumberOfChildren: 0
|
||||||
Components: ~
|
Components: ~
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: SHADE_Scripting.UI.TweenManager
|
- Type: TweenManager
|
||||||
Enabled: true
|
Enabled: true
|
||||||
- EID: 450
|
- EID: 450
|
||||||
Name: TransitionCanvas
|
Name: TransitionCanvas
|
||||||
|
|
|
@ -297,6 +297,7 @@
|
||||||
Color: {x: 1, y: 1, z: 1, w: 1}
|
Color: {x: 1, y: 1, z: 1, w: 1}
|
||||||
Layer: 4294967295
|
Layer: 4294967295
|
||||||
Strength: 0
|
Strength: 0
|
||||||
|
Casting Shadows: false
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 3
|
- EID: 3
|
||||||
|
@ -337,7 +338,7 @@
|
||||||
NumberOfChildren: 0
|
NumberOfChildren: 0
|
||||||
Components: ~
|
Components: ~
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: SHADE_Scripting.UI.TweenManager
|
- Type: TweenManager
|
||||||
Enabled: true
|
Enabled: true
|
||||||
- EID: 13
|
- EID: 13
|
||||||
Name: How To Play Canvas
|
Name: How To Play Canvas
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
Color: {x: 1, y: 1, z: 1, w: 1}
|
Color: {x: 1, y: 1, z: 1, w: 1}
|
||||||
Layer: 4294967295
|
Layer: 4294967295
|
||||||
Strength: 0
|
Strength: 0
|
||||||
|
Casting Shadows: false
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 1
|
- EID: 1
|
||||||
|
@ -152,7 +153,7 @@
|
||||||
NumberOfChildren: 0
|
NumberOfChildren: 0
|
||||||
Components: ~
|
Components: ~
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: SHADE_Scripting.UI.TweenManager
|
- Type: TweenManager
|
||||||
Enabled: true
|
Enabled: true
|
||||||
- EID: 450
|
- EID: 450
|
||||||
Name: TransitionCanvas
|
Name: TransitionCanvas
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
idleClip: 227450439
|
idleClip: 227450439
|
||||||
runClip: 229125027
|
runClip: 229125027
|
||||||
pickUpClip: 219605278
|
pickUpClip: 219605278
|
||||||
|
controlAniSys: true
|
||||||
- EID: 1
|
- EID: 1
|
||||||
Name: Default
|
Name: Default
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -80,3 +81,4 @@
|
||||||
idleClip: 0
|
idleClip: 0
|
||||||
runClip: 0
|
runClip: 0
|
||||||
pickUpClip: 0
|
pickUpClip: 0
|
||||||
|
controlAniSys: false
|
|
@ -13,6 +13,8 @@ namespace SHADE.Test
|
||||||
private AnimationClipAsset runClip;
|
private AnimationClipAsset runClip;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private AnimationClipAsset pickUpClip;
|
private AnimationClipAsset pickUpClip;
|
||||||
|
[SerializeField]
|
||||||
|
private bool controlAniSys = false;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Components
|
#region Components
|
||||||
|
@ -34,19 +36,30 @@ namespace SHADE.Test
|
||||||
// Play animations
|
// Play animations
|
||||||
if (Input.GetKeyUp(Input.KeyCode.Equals))
|
if (Input.GetKeyUp(Input.KeyCode.Equals))
|
||||||
{
|
{
|
||||||
playFunc(fullClip);
|
if (fullClip)
|
||||||
|
playFunc(fullClip);
|
||||||
}
|
}
|
||||||
else if (Input.GetKeyUp(Input.KeyCode.Alpha1))
|
else if (Input.GetKeyUp(Input.KeyCode.Alpha1))
|
||||||
{
|
{
|
||||||
playFunc(idleClip);
|
if (idleClip)
|
||||||
|
playFunc(idleClip);
|
||||||
}
|
}
|
||||||
else if (Input.GetKeyUp(Input.KeyCode.Alpha2))
|
else if (Input.GetKeyUp(Input.KeyCode.Alpha2))
|
||||||
{
|
{
|
||||||
playFunc(runClip);
|
if (runClip)
|
||||||
|
playFunc(runClip);
|
||||||
}
|
}
|
||||||
else if (Input.GetKeyUp(Input.KeyCode.Alpha3))
|
else if (Input.GetKeyUp(Input.KeyCode.Alpha3))
|
||||||
{
|
{
|
||||||
playFunc(pickUpClip);
|
if (pickUpClip)
|
||||||
|
playFunc(pickUpClip);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Play and pause
|
||||||
|
if (controlAniSys && Input.GetKeyUp(Input.KeyCode.Space))
|
||||||
|
{
|
||||||
|
AnimationSystem.TimeScale = AnimationSystem.TimeScale > 0.0f ? 0.0f
|
||||||
|
: AnimationSystem.DefaultTimeScale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -156,7 +156,7 @@ public partial class LeafSearch : BehaviourTreeNode
|
||||||
|
|
||||||
//Draw a ray, succeed if ray is unobstructed
|
//Draw a ray, succeed if ray is unobstructed
|
||||||
Vector3 eyePosition = transform.GlobalPosition + eyeOffset;
|
Vector3 eyePosition = transform.GlobalPosition + eyeOffset;
|
||||||
BoxCollider playerCollider = player.GetValueOrDefault().GetComponent<Collider>().GetCollisionShape<BoxCollider>(0);
|
Collider playerCollider = player.GetValueOrDefault().GetComponent<Collider>();
|
||||||
if (playerCollider == null)
|
if (playerCollider == null)
|
||||||
{
|
{
|
||||||
//Debug.Log("Failure: Player has no collider");
|
//Debug.Log("Failure: Player has no collider");
|
||||||
|
@ -167,7 +167,7 @@ public partial class LeafSearch : BehaviourTreeNode
|
||||||
}
|
}
|
||||||
//Ray destination to target the centre of the player's collider instead of transform position
|
//Ray destination to target the centre of the player's collider instead of transform position
|
||||||
//Since transform position is often the raccoon's base and the ray needs to hit somewhere higher to be more reliable
|
//Since transform position is often the raccoon's base and the ray needs to hit somewhere higher to be more reliable
|
||||||
Vector3 rayDestination = plrT.GlobalPosition + plrT.GlobalScale * playerCollider.PositionOffset;
|
Vector3 rayDestination = plrT.GlobalPosition + plrT.GlobalScale * playerCollider.GetCollisionShape(0).PositionOffset;
|
||||||
Ray sightRay = new Ray(eyePosition, rayDestination - eyePosition);
|
Ray sightRay = new Ray(eyePosition, rayDestination - eyePosition);
|
||||||
RaycastHit sightRayHit = Physics.Raycast(sightRay, false, (ushort)65535)[0];
|
RaycastHit sightRayHit = Physics.Raycast(sightRay, false, (ushort)65535)[0];
|
||||||
//As of November 2022, RaycastHit contains only the FIRST object hit by
|
//As of November 2022, RaycastHit contains only the FIRST object hit by
|
||||||
|
|
|
@ -86,12 +86,17 @@ public class Item : Script
|
||||||
|
|
||||||
if (returnBack && !dontReturn)
|
if (returnBack && !dontReturn)
|
||||||
{
|
{
|
||||||
|
if (rb)
|
||||||
|
{
|
||||||
|
rb.LinearVelocity = Vector3.Zero;
|
||||||
|
rb.AngularVelocity = Vector3.Zero;
|
||||||
|
rb.ClearForces();
|
||||||
|
rb.ClearTorque();
|
||||||
|
}
|
||||||
|
|
||||||
if(transform)
|
if(transform)
|
||||||
transform.LocalPosition = firstPostion;
|
transform.LocalPosition = firstPostion;
|
||||||
|
|
||||||
if (rb)
|
|
||||||
rb.LinearVelocity = Vector3.Zero;
|
|
||||||
|
|
||||||
returnBack = false;
|
returnBack = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,28 @@ using System;
|
||||||
|
|
||||||
public class PlayerIdleState : BaseState
|
public class PlayerIdleState : BaseState
|
||||||
{
|
{
|
||||||
public PlayerIdleState(StateMachine stateMachine) : base(stateMachine)
|
private bool holdItem;
|
||||||
|
public PlayerIdleState(StateMachine stateMachine, bool hi) : base(stateMachine)
|
||||||
{
|
{
|
||||||
stateName = "Idle State";
|
stateName = "Idle State";
|
||||||
|
holdItem = hi;
|
||||||
}
|
}
|
||||||
public override void OnEnter()
|
public override void OnEnter()
|
||||||
{
|
{
|
||||||
//Debug.Log("WALK ENTER");
|
//Debug.Log("WALK ENTER");
|
||||||
|
if (PlayerAnimations.Instance)
|
||||||
|
{
|
||||||
|
if (!holdItem)
|
||||||
|
{
|
||||||
|
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerIdleClip);
|
||||||
|
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerIdleClip);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerCarryIdleClip);
|
||||||
|
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerCarryIdleClip);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public override void update()
|
public override void update()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using SHADE;
|
using SHADE;
|
||||||
|
using SHADE_Scripting.Audio;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
public class PlayerRunState : BaseState
|
public class PlayerRunState : BaseState
|
||||||
|
@ -13,6 +14,11 @@ public class PlayerRunState : BaseState
|
||||||
public override void OnEnter()
|
public override void OnEnter()
|
||||||
{
|
{
|
||||||
//Debug.Log("WALK ENTER");
|
//Debug.Log("WALK ENTER");
|
||||||
|
if (PlayerAnimations.Instance)
|
||||||
|
{
|
||||||
|
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerRunClip);
|
||||||
|
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerRunClip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public override void update()
|
public override void update()
|
||||||
{
|
{
|
||||||
|
@ -21,7 +27,7 @@ public class PlayerRunState : BaseState
|
||||||
|
|
||||||
if (timer > delay)
|
if (timer > delay)
|
||||||
{
|
{
|
||||||
Audio.PlaySFXOnce2D("event:/Raccoon/raccoon_footsteps");
|
AudioHandler.audioClipHandlers["footsteps"].Play();
|
||||||
timer = 0;
|
timer = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,38 @@
|
||||||
using SHADE;
|
using SHADE;
|
||||||
|
using SHADE_Scripting.Audio;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
public class PlayerWalkState : BaseState
|
public class PlayerWalkState : BaseState
|
||||||
{
|
{
|
||||||
private float timer;
|
private float timer;
|
||||||
private float delay = 0.5f;
|
private float delay = 0.5f;
|
||||||
public PlayerWalkState(StateMachine stateMachine) : base(stateMachine)
|
private bool holdItem;
|
||||||
|
public PlayerWalkState(StateMachine stateMachine, bool hi) : base(stateMachine)
|
||||||
{
|
{
|
||||||
stateName = "Walk State";
|
stateName = "Walk State";
|
||||||
|
holdItem = hi;
|
||||||
}
|
}
|
||||||
public override void OnEnter()
|
public override void OnEnter()
|
||||||
{
|
{
|
||||||
//Debug.Log("WALK ENTER");
|
//Debug.Log("WALK ENTER");
|
||||||
timer = delay;
|
timer = delay;
|
||||||
|
if (PlayerAnimations.Instance)
|
||||||
|
{
|
||||||
|
if (!holdItem)
|
||||||
|
{
|
||||||
|
if(PlayerAnimations.Instance.playerWalkClip)
|
||||||
|
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerWalkClip);
|
||||||
|
if(PlayerAnimations.Instance.playerWalkClip)
|
||||||
|
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerWalkClip);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(PlayerAnimations.Instance.playerCarryWalkClip)
|
||||||
|
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerCarryWalkClip);
|
||||||
|
if(PlayerAnimations.Instance.playerCarryWalkClip)
|
||||||
|
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerCarryWalkClip);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public override void update()
|
public override void update()
|
||||||
{
|
{
|
||||||
|
@ -21,7 +41,7 @@ public class PlayerWalkState : BaseState
|
||||||
|
|
||||||
if (timer > delay)
|
if (timer > delay)
|
||||||
{
|
{
|
||||||
Audio.PlaySFXOnce2D("event:/Raccoon/raccoon_footsteps");
|
AudioHandler.audioClipHandlers["footsteps"].Play();
|
||||||
timer = 0;
|
timer = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,6 @@ public class PickAndThrow : Script
|
||||||
[Tooltip("Height of ray")]
|
[Tooltip("Height of ray")]
|
||||||
public float rayHeight = 0.1f;
|
public float rayHeight = 0.1f;
|
||||||
|
|
||||||
[Tooltip("FOV when you aim")]
|
|
||||||
public float aimingFOV = 50;
|
|
||||||
[Tooltip("Default FOV")]
|
|
||||||
public float defaultFOV = 45;
|
|
||||||
|
|
||||||
protected override void awake()
|
protected override void awake()
|
||||||
{
|
{
|
||||||
pc = GetScript<PlayerController>();
|
pc = GetScript<PlayerController>();
|
||||||
|
@ -85,7 +80,7 @@ public class PickAndThrow : Script
|
||||||
pc.camArm.ArmLength = aimingLength;
|
pc.camArm.ArmLength = aimingLength;
|
||||||
prevTargetOffSet = pc.camArm.TargetOffset;
|
prevTargetOffSet = pc.camArm.TargetOffset;
|
||||||
pc.camArm.TargetOffset = cameraArmOffSet;
|
pc.camArm.TargetOffset = cameraArmOffSet;
|
||||||
pc.cam.FOV = aimingFOV;
|
pc.cam.FOV = Settings.cameraFOV + 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming)
|
if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming)
|
||||||
|
@ -95,7 +90,7 @@ public class PickAndThrow : Script
|
||||||
itemCollider.GetCollisionShape(0).IsTrigger = false;
|
itemCollider.GetCollisionShape(0).IsTrigger = false;
|
||||||
pc.isAiming = false;
|
pc.isAiming = false;
|
||||||
pc.camArm.TargetOffset = prevTargetOffSet;
|
pc.camArm.TargetOffset = prevTargetOffSet;
|
||||||
pc.cam.FOV = defaultFOV;
|
pc.cam.FOV = Settings.cameraFOV;
|
||||||
if (tpc)
|
if (tpc)
|
||||||
pc.camArm.ArmLength = tpc.armLength;
|
pc.camArm.ArmLength = tpc.armLength;
|
||||||
pc.holdItem = false;
|
pc.holdItem = false;
|
||||||
|
@ -116,7 +111,7 @@ public class PickAndThrow : Script
|
||||||
if (Input.GetMouseButtonDown(Input.MouseCode.RightButton) && pc.isAiming)
|
if (Input.GetMouseButtonDown(Input.MouseCode.RightButton) && pc.isAiming)
|
||||||
{
|
{
|
||||||
pc.isAiming = false;
|
pc.isAiming = false;
|
||||||
pc.cam.FOV = defaultFOV;
|
pc.cam.FOV = Settings.cameraFOV;
|
||||||
pc.camArm.TargetOffset = prevTargetOffSet;
|
pc.camArm.TargetOffset = prevTargetOffSet;
|
||||||
if (tpc)
|
if (tpc)
|
||||||
pc.camArm.ArmLength = tpc.armLength;
|
pc.camArm.ArmLength = tpc.armLength;
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
using SHADE;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|
||||||
|
public class PlayerAnimations : Script
|
||||||
|
{
|
||||||
|
#region Raccoon
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerIdleClip; // done
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerWalkClip; // done
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerRunClip; // done
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerPickUpClip;
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerCarryIdleClip; // done
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerCarryWalkClip; // done
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerThrowClip;
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerJumpStartClip;
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerJumpLoopClip;
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerJumpEndClip;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Animator
|
||||||
|
public Animator playerAnimator { get; private set; }
|
||||||
|
public Animator BagAnimator { get; private set; }
|
||||||
|
public Animator silhoPlayerAnimator { get; private set; }
|
||||||
|
public Animator silhoBagAnimator { get; private set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region silhouette
|
||||||
|
public GameObject silhouettePlayer;
|
||||||
|
public GameObject silhouetteBag;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public static PlayerAnimations Instance { get; private set; }
|
||||||
|
|
||||||
|
protected override void awake()
|
||||||
|
{
|
||||||
|
if (Instance != null && Instance != this)
|
||||||
|
RemoveScript<PlayerAnimations>();
|
||||||
|
else
|
||||||
|
Instance = this;
|
||||||
|
|
||||||
|
playerAnimator = GetComponent<Animator>();
|
||||||
|
if (!playerAnimator)
|
||||||
|
Debug.LogError("Player Animator is MISSING!");
|
||||||
|
|
||||||
|
BagAnimator = GetComponentInChildren<Animator>();
|
||||||
|
if (!BagAnimator)
|
||||||
|
Debug.LogError("Bag Animator is MISSING!");
|
||||||
|
|
||||||
|
if(!silhouettePlayer)
|
||||||
|
silhoPlayerAnimator = silhouettePlayer.GetComponent<Animator>();
|
||||||
|
else
|
||||||
|
Debug.LogError("Silho Player is MISSING!");
|
||||||
|
if (!silhoPlayerAnimator)
|
||||||
|
Debug.LogError("Silho Player Animator is MISSING!");
|
||||||
|
|
||||||
|
if(!silhouetteBag)
|
||||||
|
silhoBagAnimator = silhouetteBag.GetComponent<Animator>();
|
||||||
|
else
|
||||||
|
Debug.LogError("Silho bag is MISSING!");
|
||||||
|
if (!silhoBagAnimator)
|
||||||
|
Debug.LogError("Silho Player Animator is MISSING!");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void onDestroy()
|
||||||
|
{
|
||||||
|
if (Instance == this)
|
||||||
|
Instance = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Name: SC_PlayerAnimations
|
||||||
|
ID: 159045981
|
||||||
|
Type: 9
|
|
@ -1,6 +1,7 @@
|
||||||
using SHADE;
|
using SHADE;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using SHADE_Scripting.Audio;
|
||||||
using static Item;
|
using static Item;
|
||||||
|
|
||||||
public class PlayerController : Script
|
public class PlayerController : Script
|
||||||
|
@ -32,7 +33,7 @@ public class PlayerController : Script
|
||||||
private float delayTimer = 0.0f;
|
private float delayTimer = 0.0f;
|
||||||
|
|
||||||
[Tooltip("The current state fo the raccoon")]
|
[Tooltip("The current state fo the raccoon")]
|
||||||
public RaccoonStates currentState = RaccoonStates.IDLE;
|
public RaccoonStates currentState;
|
||||||
|
|
||||||
//Movement variables============================================================
|
//Movement variables============================================================
|
||||||
[Tooltip("Max vel for walking")]
|
[Tooltip("Max vel for walking")]
|
||||||
|
@ -98,17 +99,17 @@ public class PlayerController : Script
|
||||||
//rigidbody check
|
//rigidbody check
|
||||||
rb = GetComponent<RigidBody>();
|
rb = GetComponent<RigidBody>();
|
||||||
if (!rb)
|
if (!rb)
|
||||||
Debug.LogError("RigidBody is NULL!");
|
Debug.LogError("RigidBody is MISSING!");
|
||||||
|
|
||||||
//Transform check
|
//Transform check
|
||||||
tranform = GetComponent<Transform>();
|
tranform = GetComponent<Transform>();
|
||||||
if(!tranform)
|
if(!tranform)
|
||||||
Debug.LogError("tranform is NULL!");
|
Debug.LogError("tranform is MISSING!");
|
||||||
|
|
||||||
stateMachine = AddScript<StateMachine>();
|
stateMachine = AddScript<StateMachine>();
|
||||||
Dictionary<Type, BaseState> dictionary = new Dictionary<Type, BaseState>();
|
Dictionary<Type, BaseState> dictionary = new Dictionary<Type, BaseState>();
|
||||||
dictionary.Add(typeof(PlayerIdleState), new PlayerIdleState(stateMachine));
|
dictionary.Add(typeof(PlayerIdleState), new PlayerIdleState(stateMachine, holdItem));
|
||||||
dictionary.Add(typeof(PlayerWalkState), new PlayerWalkState(stateMachine));
|
dictionary.Add(typeof(PlayerWalkState), new PlayerWalkState(stateMachine, holdItem));
|
||||||
dictionary.Add(typeof(PlayerRunState), new PlayerRunState(stateMachine));
|
dictionary.Add(typeof(PlayerRunState), new PlayerRunState(stateMachine));
|
||||||
dictionary.Add(typeof(PlayerJumpState), new PlayerJumpState(stateMachine));
|
dictionary.Add(typeof(PlayerJumpState), new PlayerJumpState(stateMachine));
|
||||||
dictionary.Add(typeof(PlayerFallState), new PlayerFallState(stateMachine));
|
dictionary.Add(typeof(PlayerFallState), new PlayerFallState(stateMachine));
|
||||||
|
@ -131,6 +132,14 @@ public class PlayerController : Script
|
||||||
silhouetteBagRend = silhouetteBag.GetComponent<Renderable>();
|
silhouetteBagRend = silhouetteBag.GetComponent<Renderable>();
|
||||||
silhouetteBagRend.Material.SetProperty<float>("data.offset", 0.1f);
|
silhouetteBagRend.Material.SetProperty<float>("data.offset", 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AudioHandler.audioClipHandlers["footsteps"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_footsteps");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void start()
|
||||||
|
{
|
||||||
|
currentState = RaccoonStates.IDLE;
|
||||||
|
stateMachine.SetState(typeof(PlayerIdleState));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void lateUpdate()
|
protected override void lateUpdate()
|
||||||
|
@ -167,8 +176,8 @@ public class PlayerController : Script
|
||||||
if (!cam)
|
if (!cam)
|
||||||
{
|
{
|
||||||
cam = GetComponentInChildren<Camera>();
|
cam = GetComponentInChildren<Camera>();
|
||||||
if(pat)
|
if (pat)
|
||||||
cam.FOV = pat.defaultFOV;
|
cam.FOV = Settings.cameraFOV;
|
||||||
}
|
}
|
||||||
if(!camArm)
|
if(!camArm)
|
||||||
camArm = GetComponentInChildren<CameraArm>();
|
camArm = GetComponentInChildren<CameraArm>();
|
||||||
|
@ -417,7 +426,7 @@ public class PlayerController : Script
|
||||||
if (isAiming)
|
if (isAiming)
|
||||||
{
|
{
|
||||||
isAiming = false;
|
isAiming = false;
|
||||||
cam.FOV = pat.defaultFOV;
|
cam.FOV = Settings.cameraFOV;
|
||||||
camArm.TargetOffset = pat.prevTargetOffSet;
|
camArm.TargetOffset = pat.prevTargetOffSet;
|
||||||
camArm.ArmLength = pat.tpc.armLength;
|
camArm.ArmLength = pat.tpc.armLength;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ namespace SHADE_Scripting
|
||||||
protected override void start()
|
protected override void start()
|
||||||
{
|
{
|
||||||
GetComponent<CameraArm>().ArmLength = armLength;
|
GetComponent<CameraArm>().ArmLength = armLength;
|
||||||
|
GetComponent<Camera>().FOV = Settings.cameraFOV;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void update()
|
protected override void update()
|
||||||
|
|
|
@ -2,15 +2,64 @@
|
||||||
using SHADE_Scripting.Audio;
|
using SHADE_Scripting.Audio;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|
||||||
public class JumpPad : Script
|
public class JumpPad : Script
|
||||||
{
|
{
|
||||||
|
private Transform tran;
|
||||||
|
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 scaleYUp;
|
||||||
|
[NonSerialized]
|
||||||
|
private TweenThread scaleXZUp;
|
||||||
|
[NonSerialized]
|
||||||
|
private TweenThreadVec3 scaleDown;
|
||||||
|
|
||||||
protected override void awake()
|
protected override void awake()
|
||||||
{
|
{
|
||||||
AudioHandler.audioClipHandlers["SFXJumpPad"] = Audio.CreateAudioClip("event:/Props/jumppad_boing");
|
AudioHandler.audioClipHandlers["SFXJumpPad"] = Audio.CreateAudioClip("event:/Props/jumppad_boing");
|
||||||
|
|
||||||
|
tran = GameObject.GetComponent<Transform>();
|
||||||
|
if (!tran)
|
||||||
|
Debug.LogError("NO TRANSFORM");
|
||||||
|
|
||||||
|
defaultScale = tran.LocalScale;
|
||||||
|
scaleXZMaxSize = scaleYMaxSize * 0.3f;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void start()
|
||||||
|
{
|
||||||
|
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()
|
protected override void update()
|
||||||
{
|
{
|
||||||
|
if (landed && tran)
|
||||||
|
{
|
||||||
|
tran.LocalScale = new Vector3(scaleXZUp.GetValue(), scaleYUp.GetValue(), scaleXZUp.GetValue());
|
||||||
|
if (scaleYUp.IsCompleted() && scaleXZUp.IsCompleted())
|
||||||
|
{
|
||||||
|
landed = false;
|
||||||
|
scaleUpDone = true;
|
||||||
|
scaleDown = TweenManager.CreateTweenThreadVec3(scaleDuration, tran.LocalScale, defaultScale, EASING_METHOD.EASE_IN_SINE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scaleUpDone && !landed)
|
||||||
|
{
|
||||||
|
tran.LocalScale = scaleDown.GetValue();
|
||||||
|
if (scaleDown.IsCompleted())
|
||||||
|
{
|
||||||
|
scaleUpDone = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void onCollisionEnter(CollisionInfo info)
|
protected override void onCollisionEnter(CollisionInfo info)
|
||||||
|
@ -20,7 +69,11 @@ public class JumpPad : Script
|
||||||
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXJumpPad"], GameObject.EntityId);
|
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXJumpPad"], GameObject.EntityId);
|
||||||
AudioHandler.audioClipHandlers["SFXJumpPad"].Play();
|
AudioHandler.audioClipHandlers["SFXJumpPad"].Play();
|
||||||
info.GameObject.GetScript<PlayerController>().landedOnJumpPad = true;
|
info.GameObject.GetScript<PlayerController>().landedOnJumpPad = true;
|
||||||
|
landed = true;
|
||||||
|
scaleYUp.Reset();
|
||||||
|
scaleXZUp.Reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -4,18 +4,14 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace SHADE_Scripting
|
static public class Settings
|
||||||
{
|
{
|
||||||
static public class Settings
|
static public float cameraSensitivity = 100.0f;
|
||||||
{
|
|
||||||
static public float cameraSensitivity = 100.0f;
|
|
||||||
|
|
||||||
static public float cameraFOV = 90.0f;
|
static public float cameraFOV = 45.0f;
|
||||||
|
|
||||||
static public float masterVolume = 100.0f;
|
static public float masterVolume = 100.0f;
|
||||||
static public float sfxVolume = 100.0f;
|
static public float sfxVolume = 100.0f;
|
||||||
static public float bgmVolume = 100.0f;
|
static public float bgmVolume = 100.0f;
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,6 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace SHADE_Scripting.UI
|
|
||||||
{
|
|
||||||
|
|
||||||
public enum EASING_METHOD
|
public enum EASING_METHOD
|
||||||
{
|
{
|
||||||
EASE_IN_SINE,
|
EASE_IN_SINE,
|
||||||
|
@ -16,84 +13,88 @@ namespace SHADE_Scripting.UI
|
||||||
EASE_INOUT_BOUNCE
|
EASE_INOUT_BOUNCE
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EasingHelper
|
public static class EasingHelper
|
||||||
|
{
|
||||||
|
|
||||||
|
public static float EaseHelp(float value, EASING_METHOD method)
|
||||||
|
{
|
||||||
|
switch (method)
|
||||||
{
|
{
|
||||||
|
case EASING_METHOD.EASE_IN_SINE:
|
||||||
public static float EaseHelp(float value, EASING_METHOD method)
|
|
||||||
{
|
{
|
||||||
switch (method)
|
return EaseInSine(value);
|
||||||
{
|
|
||||||
case EASING_METHOD.EASE_IN_SINE:
|
|
||||||
{
|
|
||||||
return EaseInSine(value);
|
|
||||||
}break;
|
|
||||||
case EASING_METHOD.EASE_OUT_SINE:
|
|
||||||
{
|
|
||||||
return EaseOutSine(value);
|
|
||||||
}break;
|
|
||||||
case EASING_METHOD.EASE_OUT_BOUNCE:
|
|
||||||
{
|
|
||||||
return EaseOutBounce(value);
|
|
||||||
}break;
|
|
||||||
case EASING_METHOD.EASE_IN_BOUNCE:
|
|
||||||
{
|
|
||||||
return EaseInBounce(value);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case EASING_METHOD.EASE_INOUT_BOUNCE:
|
|
||||||
{
|
|
||||||
return EaseInOutBounce(value);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
private static float EaseInSine(float value)
|
case EASING_METHOD.EASE_OUT_SINE:
|
||||||
{
|
{
|
||||||
|
return EaseOutSine(value);
|
||||||
return (float)(1.0f - Math.Cos((value * Math.PI / 2.0f) ));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
private static float EaseOutSine(float value)
|
case EASING_METHOD.EASE_OUT_BOUNCE:
|
||||||
{
|
{
|
||||||
return (float)(Math.Sin(value * Math.PI / 2.0f) );
|
return EaseOutBounce(value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case EASING_METHOD.EASE_IN_BOUNCE:
|
||||||
private static float EaseOutBounce(float value)
|
|
||||||
{
|
{
|
||||||
const float n1 = 7.5625f;
|
return EaseInBounce(value);
|
||||||
const float d1 = 2.75f;
|
|
||||||
if (value < 1.0f / d1)
|
|
||||||
{
|
|
||||||
return n1 * value * value;
|
|
||||||
} else if (value < 2.0f / d1)
|
|
||||||
{
|
|
||||||
return n1 * (value -= 2.25f / d1) * value + 0.9375f;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return n1 * (value -= 2.625f / d1) * value + 0.984375f;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
private static float EaseInBounce(float value)
|
case EASING_METHOD.EASE_INOUT_BOUNCE:
|
||||||
{
|
{
|
||||||
return 1 - EaseOutBounce(1 - value);
|
return EaseInOutBounce(value);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float EaseInSine(float value)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (float)(1.0f - Math.Cos((value * Math.PI / 2.0f)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float EaseOutSine(float value)
|
||||||
|
{
|
||||||
|
return (float)(Math.Sin(value * Math.PI / 2.0f));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static float EaseInOutBounce(float value)
|
private static float EaseOutBounce(float value)
|
||||||
{
|
{
|
||||||
return (value < 0.5f)
|
const float n1 = 7.5625f;
|
||||||
?(1.0f - EaseOutBounce(1.0f - 2.0f * value)) / 2.0f
|
const float d1 = 2.75f;
|
||||||
: (1.0f + EaseOutBounce(2.0f * value - 1.0f)) / 2.0f;
|
if (value < 1.0f / d1)
|
||||||
}
|
{
|
||||||
|
return n1 * value * value;
|
||||||
|
}
|
||||||
|
else if (value < 2.0f / d1)
|
||||||
|
{
|
||||||
|
return n1 * (value -= 2.25f / d1) * value + 0.9375f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return n1 * (value -= 2.625f / d1) * value + 0.984375f;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float EaseInBounce(float value)
|
||||||
|
{
|
||||||
|
return 1 - EaseOutBounce(1 - value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static float EaseInOutBounce(float value)
|
||||||
|
{
|
||||||
|
return (value < 0.5f)
|
||||||
|
? (1.0f - EaseOutBounce(1.0f - 2.0f * value)) / 2.0f
|
||||||
|
: (1.0f + EaseOutBounce(2.0f * value - 1.0f)) / 2.0f;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,89 +7,93 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace SHADE_Scripting.UI
|
namespace SHADE_Scripting.UI
|
||||||
{
|
{
|
||||||
public class Options:Script
|
public class Options : Script
|
||||||
|
{
|
||||||
|
public GameObject masterVolSlider;
|
||||||
|
public GameObject sfxVolSlider;
|
||||||
|
public GameObject bgmVolSlider;
|
||||||
|
public GameObject fovSlider;
|
||||||
|
public GameObject sensitivitySlider;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected override void awake()
|
||||||
{
|
{
|
||||||
public GameObject masterVolSlider;
|
Slider mv = masterVolSlider.GetComponent<Slider>();
|
||||||
public GameObject sfxVolSlider;
|
Slider sfx = sfxVolSlider.GetComponent<Slider>();
|
||||||
public GameObject bgmVolSlider;
|
Slider bgm = bgmVolSlider.GetComponent<Slider>();
|
||||||
public GameObject fovSlider;
|
Slider fov = fovSlider.GetComponent<Slider>();
|
||||||
public GameObject sensitivitySlider;
|
Slider sens = sensitivitySlider.GetComponent<Slider>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (mv != null)
|
||||||
|
{
|
||||||
|
mv.ScaledValue = Settings.masterVolume;
|
||||||
|
|
||||||
protected override void awake()
|
}
|
||||||
{
|
if (sfx != null)
|
||||||
Slider mv = masterVolSlider.GetComponent<Slider>();
|
{
|
||||||
Slider sfx = sfxVolSlider.GetComponent<Slider>();
|
sfx.ScaledValue = Settings.sfxVolume;
|
||||||
Slider bgm = bgmVolSlider.GetComponent<Slider>();
|
|
||||||
Slider fov = fovSlider.GetComponent<Slider>();
|
|
||||||
Slider sens = sensitivitySlider.GetComponent<Slider>();
|
|
||||||
|
|
||||||
|
}
|
||||||
|
if (bgm != null)
|
||||||
|
{
|
||||||
|
bgm.ScaledValue = Settings.bgmVolume;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (fov != null)
|
||||||
|
{
|
||||||
|
fov.ScaledValue = Settings.cameraFOV;
|
||||||
|
|
||||||
if (mv != null)
|
}
|
||||||
{
|
if (sens != null)
|
||||||
mv.ScaledValue = Settings.masterVolume;
|
{
|
||||||
|
sens.ScaledValue = Settings.cameraSensitivity;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (sfx != null)
|
|
||||||
{
|
|
||||||
sfx.ScaledValue = Settings.sfxVolume;
|
|
||||||
|
|
||||||
}
|
|
||||||
if (bgm != null)
|
|
||||||
{
|
|
||||||
bgm.ScaledValue = Settings.bgmVolume;
|
|
||||||
|
|
||||||
}
|
|
||||||
if (fov != null)
|
|
||||||
{
|
|
||||||
fov.ScaledValue = Settings.cameraFOV;
|
|
||||||
|
|
||||||
}
|
|
||||||
if (sens != null)
|
|
||||||
{
|
|
||||||
sens.ScaledValue = Settings.cameraSensitivity;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected override void update()
|
|
||||||
{
|
|
||||||
Slider mv = masterVolSlider.GetComponent<Slider>();
|
|
||||||
Slider sfx = sfxVolSlider.GetComponent<Slider>();
|
|
||||||
Slider bgm = bgmVolSlider.GetComponent<Slider>();
|
|
||||||
Slider fov = fovSlider.GetComponent<Slider>();
|
|
||||||
Slider sens = sensitivitySlider.GetComponent<Slider>();
|
|
||||||
|
|
||||||
if(mv != null)
|
|
||||||
{
|
|
||||||
Settings.masterVolume = mv.ScaledValue;
|
|
||||||
}
|
|
||||||
if (sfx != null)
|
|
||||||
{
|
|
||||||
Settings.sfxVolume = sfx.ScaledValue;
|
|
||||||
}
|
|
||||||
if (bgm != null)
|
|
||||||
{
|
|
||||||
Settings.bgmVolume = bgm.ScaledValue;
|
|
||||||
}
|
|
||||||
if (fov != null)
|
|
||||||
{
|
|
||||||
Settings.cameraFOV = fov.ScaledValue;
|
|
||||||
}
|
|
||||||
if (sens != null)
|
|
||||||
{
|
|
||||||
Settings.cameraSensitivity = sens.ScaledValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void update()
|
||||||
|
{
|
||||||
|
Slider mv = masterVolSlider.GetComponent<Slider>();
|
||||||
|
Slider sfx = sfxVolSlider.GetComponent<Slider>();
|
||||||
|
Slider bgm = bgmVolSlider.GetComponent<Slider>();
|
||||||
|
Slider fov = fovSlider.GetComponent<Slider>();
|
||||||
|
Slider sens = sensitivitySlider.GetComponent<Slider>();
|
||||||
|
|
||||||
|
if (mv != null)
|
||||||
|
{
|
||||||
|
Settings.masterVolume = mv.ScaledValue * 0.01f;
|
||||||
|
SHADE.Audio.SetVCAVolume("vca:/MASTER", Settings.masterVolume);
|
||||||
|
}
|
||||||
|
if (sfx != null)
|
||||||
|
{
|
||||||
|
Settings.sfxVolume = sfx.ScaledValue;
|
||||||
|
SHADE.Audio.SetVCAVolume("vca:/SFX", Settings.sfxVolume);
|
||||||
|
SHADE.Audio.SetVCAVolume("vca:/UI", Settings.sfxVolume);
|
||||||
|
}
|
||||||
|
if (bgm != null)
|
||||||
|
{
|
||||||
|
Settings.bgmVolume = bgm.ScaledValue;
|
||||||
|
SHADE.Audio.SetVCAVolume("vca:/MUSIC", Settings.bgmVolume);
|
||||||
|
}
|
||||||
|
if (fov != null)
|
||||||
|
{
|
||||||
|
Settings.cameraFOV = fov.ScaledValue;
|
||||||
|
}
|
||||||
|
if (sens != null)
|
||||||
|
{
|
||||||
|
Settings.cameraSensitivity = sens.ScaledValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ public class PauseMenu : Script
|
||||||
if (canvas)
|
if (canvas)
|
||||||
canvas.SetActive(false);
|
canvas.SetActive(false);
|
||||||
Application.FixDeltaTime = Time.DefaultFixDeltaTime;
|
Application.FixDeltaTime = Time.DefaultFixDeltaTime;
|
||||||
|
AnimationSystem.TimeScale = AnimationSystem.DefaultTimeScale;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -106,6 +107,7 @@ public class PauseMenu : Script
|
||||||
if (canvas)
|
if (canvas)
|
||||||
canvas.SetActive(true);
|
canvas.SetActive(true);
|
||||||
Application.FixDeltaTime = 0;
|
Application.FixDeltaTime = 0;
|
||||||
|
AnimationSystem.TimeScale = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -4,190 +4,182 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
|
public class TweenThread
|
||||||
namespace SHADE_Scripting.UI
|
|
||||||
{
|
{
|
||||||
|
private float timer = 0.0f;
|
||||||
|
public float duration = 1.0f;
|
||||||
|
public EASING_METHOD method;
|
||||||
|
private float value = 0.0f;
|
||||||
|
public float startValue = 0.0f;
|
||||||
|
public float endValue = 1.0f;
|
||||||
|
public TweenThread(float duration, float startValue, float endValue, EASING_METHOD method)
|
||||||
|
{
|
||||||
|
this.duration = duration;
|
||||||
|
this.method = method;
|
||||||
|
this.startValue = startValue;
|
||||||
|
this.endValue = endValue;
|
||||||
|
}
|
||||||
|
public void Update(float deltaTime)
|
||||||
|
{
|
||||||
|
if (timer >= duration)
|
||||||
|
return;
|
||||||
|
|
||||||
|
timer += deltaTime;
|
||||||
|
if (timer >= duration)
|
||||||
|
timer = duration;
|
||||||
|
|
||||||
|
value = EasingHelper.EaseHelp(timer / duration, method) * (endValue - startValue) + startValue;
|
||||||
|
}
|
||||||
|
public bool IsCompleted()
|
||||||
|
{
|
||||||
|
return timer >= duration;
|
||||||
|
}
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
timer = 0.0f;
|
||||||
|
value = startValue;
|
||||||
|
}
|
||||||
|
public void Reset(float startValue, float endValue)
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
this.startValue = startValue;
|
||||||
|
this.endValue = endValue;
|
||||||
|
}
|
||||||
|
public void ResetInvert()
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
float temp = startValue;
|
||||||
|
startValue = endValue;
|
||||||
|
endValue = temp;
|
||||||
|
}
|
||||||
|
public float GetValue()
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class TweenThreadVec3
|
||||||
|
{
|
||||||
|
private float timer = 0.0f;
|
||||||
|
public float duration = 1.0f;
|
||||||
|
public EASING_METHOD method;
|
||||||
|
private Vector3 value = Vector3.Zero;
|
||||||
|
public Vector3 startValue = Vector3.Zero;
|
||||||
|
public Vector3 endValue = Vector3.Zero;
|
||||||
|
public TweenThreadVec3(float duration, Vector3 startValue, Vector3 endValue, EASING_METHOD method)
|
||||||
|
{
|
||||||
|
this.duration = duration;
|
||||||
|
this.method = method;
|
||||||
|
this.startValue = startValue;
|
||||||
|
this.endValue = endValue;
|
||||||
|
}
|
||||||
|
public void Update(float deltaTime)
|
||||||
|
{
|
||||||
|
if (timer >= duration)
|
||||||
|
return;
|
||||||
|
|
||||||
|
timer += deltaTime;
|
||||||
|
if (timer >= duration)
|
||||||
|
timer = duration;
|
||||||
|
|
||||||
|
value = (endValue - startValue) * EasingHelper.EaseHelp(timer / duration, method) + startValue;
|
||||||
|
}
|
||||||
|
public bool IsCompleted()
|
||||||
|
{
|
||||||
|
return timer >= duration;
|
||||||
|
}
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
timer = 0.0f;
|
||||||
|
value = startValue;
|
||||||
|
}
|
||||||
|
public void Reset(Vector3 startValue, Vector3 endValue)
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
this.startValue = startValue;
|
||||||
|
this.endValue = endValue;
|
||||||
|
}
|
||||||
|
public void ResetInvert()
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
Vector3 temp = startValue;
|
||||||
|
startValue = endValue;
|
||||||
|
endValue = temp;
|
||||||
|
}
|
||||||
|
public Vector3 GetValue()
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class TweenManager : Script
|
||||||
|
{
|
||||||
|
public static TweenManager Instance { get; private set; }
|
||||||
|
|
||||||
|
[NonSerialized]
|
||||||
|
private List<TweenThread> threadList;
|
||||||
|
|
||||||
|
[NonSerialized]
|
||||||
|
private List<TweenThreadVec3> threadVec3List;
|
||||||
|
|
||||||
|
protected override void awake()
|
||||||
|
{
|
||||||
|
if (Instance != null && Instance != this)
|
||||||
|
RemoveScript<TweenManager>();
|
||||||
|
else
|
||||||
|
Instance = this;
|
||||||
|
|
||||||
|
threadList = new List<TweenThread>();
|
||||||
|
threadVec3List = new List<TweenThreadVec3>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void onDestroy()
|
||||||
|
{
|
||||||
|
if (Instance == this)
|
||||||
|
Instance = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void update()
|
||||||
|
{
|
||||||
|
foreach (TweenThread thread in threadList)
|
||||||
|
{
|
||||||
|
thread.Update(Time.DeltaTimeF);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (TweenThreadVec3 thread in threadVec3List)
|
||||||
|
{
|
||||||
|
thread.Update(Time.DeltaTimeF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static TweenThread CreateTweenThread(float duration, float startValue, float endValue, EASING_METHOD method)
|
||||||
|
{
|
||||||
|
if (Instance == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
TweenThread thread = new TweenThread(duration, startValue, endValue, method);
|
||||||
|
Instance.threadList.Add(thread);
|
||||||
|
thread.Reset();
|
||||||
|
return thread;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TweenThreadVec3 CreateTweenThreadVec3(float duration, Vector3 startValue, Vector3 endValue, EASING_METHOD method)
|
||||||
|
{
|
||||||
|
if (Instance == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
|
||||||
|
TweenThreadVec3 thread = new TweenThreadVec3(duration, startValue, endValue, method);
|
||||||
|
Instance.threadVec3List.Add(thread);
|
||||||
|
thread.Reset();
|
||||||
|
return thread;
|
||||||
|
}
|
||||||
|
|
||||||
public class TweenThread
|
|
||||||
{
|
|
||||||
private float timer = 0.0f;
|
|
||||||
public float duration = 1.0f;
|
|
||||||
public EASING_METHOD method;
|
|
||||||
private float value = 0.0f;
|
|
||||||
public float startValue = 0.0f;
|
|
||||||
public float endValue = 1.0f;
|
|
||||||
public TweenThread(float duration, float startValue, float endValue, EASING_METHOD method)
|
|
||||||
{
|
|
||||||
this.duration = duration;
|
|
||||||
this.method = method;
|
|
||||||
this.startValue = startValue;
|
|
||||||
this.endValue = endValue;
|
|
||||||
}
|
|
||||||
public void Update(float deltaTime)
|
|
||||||
{
|
|
||||||
if (timer >= duration)
|
|
||||||
return;
|
|
||||||
|
|
||||||
timer += deltaTime;
|
|
||||||
if (timer >= duration)
|
|
||||||
timer = duration;
|
|
||||||
|
|
||||||
value = EasingHelper.EaseHelp(timer/duration, method) * (endValue - startValue) + startValue ;
|
|
||||||
}
|
|
||||||
public bool IsCompleted()
|
|
||||||
{
|
|
||||||
return timer >= duration;
|
|
||||||
}
|
|
||||||
public void Reset()
|
|
||||||
{
|
|
||||||
timer = 0.0f;
|
|
||||||
value = startValue;
|
|
||||||
}
|
|
||||||
public void Reset(float startValue, float endValue)
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
this.startValue = startValue;
|
|
||||||
this.endValue = endValue;
|
|
||||||
}
|
|
||||||
public void ResetInvert()
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
float temp = startValue;
|
|
||||||
startValue = endValue;
|
|
||||||
endValue = temp;
|
|
||||||
}
|
|
||||||
public float GetValue()
|
|
||||||
{
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class TweenThreadVec3
|
|
||||||
{
|
|
||||||
private float timer = 0.0f;
|
|
||||||
public float duration = 1.0f;
|
|
||||||
public EASING_METHOD method;
|
|
||||||
private Vector3 value = Vector3.Zero;
|
|
||||||
public Vector3 startValue = Vector3.Zero;
|
|
||||||
public Vector3 endValue = Vector3.Zero;
|
|
||||||
public TweenThreadVec3(float duration, Vector3 startValue, Vector3 endValue, EASING_METHOD method)
|
|
||||||
{
|
|
||||||
this.duration = duration;
|
|
||||||
this.method = method;
|
|
||||||
this.startValue = startValue;
|
|
||||||
this.endValue = endValue;
|
|
||||||
}
|
|
||||||
public void Update(float deltaTime)
|
|
||||||
{
|
|
||||||
if (timer >= duration)
|
|
||||||
return;
|
|
||||||
|
|
||||||
timer += deltaTime;
|
|
||||||
if (timer >= duration)
|
|
||||||
timer = duration;
|
|
||||||
|
|
||||||
value = (endValue - startValue) * EasingHelper.EaseHelp(timer / duration, method) + startValue;
|
|
||||||
}
|
|
||||||
public bool IsCompleted()
|
|
||||||
{
|
|
||||||
return timer >= duration;
|
|
||||||
}
|
|
||||||
public void Reset()
|
|
||||||
{
|
|
||||||
timer = 0.0f;
|
|
||||||
value = startValue;
|
|
||||||
}
|
|
||||||
public void Reset(Vector3 startValue, Vector3 endValue)
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
this.startValue = startValue;
|
|
||||||
this.endValue = endValue;
|
|
||||||
}
|
|
||||||
public void ResetInvert()
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
Vector3 temp = startValue;
|
|
||||||
startValue = endValue;
|
|
||||||
endValue = temp;
|
|
||||||
}
|
|
||||||
public Vector3 GetValue()
|
|
||||||
{
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class TweenManager : Script
|
|
||||||
{
|
|
||||||
public static TweenManager Instance { get; private set; }
|
|
||||||
|
|
||||||
[NonSerialized]
|
|
||||||
private List<TweenThread> threadList;
|
|
||||||
|
|
||||||
[NonSerialized]
|
|
||||||
private List<TweenThreadVec3> threadVec3List;
|
|
||||||
|
|
||||||
protected override void awake()
|
|
||||||
{
|
|
||||||
if (Instance != null && Instance != this)
|
|
||||||
RemoveScript<TweenManager>();
|
|
||||||
else
|
|
||||||
Instance = this;
|
|
||||||
|
|
||||||
threadList = new List<TweenThread>();
|
|
||||||
threadVec3List = new List<TweenThreadVec3>();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void onDestroy()
|
|
||||||
{
|
|
||||||
if (Instance == this)
|
|
||||||
Instance = null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void update()
|
|
||||||
{
|
|
||||||
foreach (TweenThread thread in threadList)
|
|
||||||
{
|
|
||||||
thread.Update(Time.DeltaTimeF);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (TweenThreadVec3 thread in threadVec3List)
|
|
||||||
{
|
|
||||||
thread.Update(Time.DeltaTimeF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static TweenThread CreateTweenThread(float duration, float startValue, float endValue, EASING_METHOD method)
|
|
||||||
{
|
|
||||||
if (Instance == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
|
|
||||||
TweenThread thread = new TweenThread(duration, startValue, endValue, method);
|
|
||||||
Instance.threadList.Add(thread);
|
|
||||||
thread.Reset();
|
|
||||||
return thread;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TweenThreadVec3 CreateTweenThreadVec3(float duration, Vector3 startValue, Vector3 endValue, EASING_METHOD method)
|
|
||||||
{
|
|
||||||
if (Instance == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
|
|
||||||
TweenThreadVec3 thread = new TweenThreadVec3(duration, startValue, endValue, method);
|
|
||||||
Instance.threadVec3List.Add(thread);
|
|
||||||
thread.Reset();
|
|
||||||
return thread;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,17 +15,14 @@ public abstract class BaseState
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnEnter()
|
public virtual void OnEnter()
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void update();
|
public abstract void update();
|
||||||
|
|
||||||
public abstract void fixedUpdate();
|
public abstract void fixedUpdate();
|
||||||
|
|
||||||
public virtual void OnExit()
|
public virtual void OnExit()
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetStateName()
|
public string GetStateName()
|
||||||
{
|
{
|
||||||
|
@ -37,11 +34,6 @@ public abstract class BaseState
|
||||||
return animationName;
|
return animationName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual float GetAnimPercent()
|
|
||||||
{
|
|
||||||
return 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void onCollisionEnter(CollisionInfo info)
|
public virtual void onCollisionEnter(CollisionInfo info)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ namespace SHADE
|
||||||
void SHAnimationSystem::UpdateRoutine::Execute(double dt) noexcept
|
void SHAnimationSystem::UpdateRoutine::Execute(double dt) noexcept
|
||||||
{
|
{
|
||||||
auto& animators = SHComponentManager::GetDense<SHAnimatorComponent>();
|
auto& animators = SHComponentManager::GetDense<SHAnimatorComponent>();
|
||||||
|
dt *= reinterpret_cast<SHAnimationSystem*>(system)->TimeScale;
|
||||||
for (auto& animator : animators)
|
for (auto& animator : animators)
|
||||||
{
|
{
|
||||||
animator.Update(dt);
|
animator.Update(dt);
|
||||||
|
|
|
@ -42,6 +42,23 @@ namespace SHADE
|
||||||
void Execute(double dt) noexcept override final;
|
void Execute(double dt) noexcept override final;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* Constants */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Default time scale used by the system.
|
||||||
|
/// </summary>
|
||||||
|
static constexpr double DEFAULT_TIME_SCALE = 1.0;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* Public Data Members */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Used by the system to multiply the given delta time to scale the animation
|
||||||
|
/// speed.
|
||||||
|
/// </summary>
|
||||||
|
double TimeScale = DEFAULT_TIME_SCALE;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Constructors */
|
/* Constructors */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -31,6 +31,6 @@ namespace SHADE
|
||||||
struct SH_API SHAnimClipContainerAsset final : SHAssetData
|
struct SH_API SHAnimClipContainerAsset final : SHAssetData
|
||||||
{
|
{
|
||||||
AssetID animRawDataAssetId;
|
AssetID animRawDataAssetId;
|
||||||
std::vector<SHAnimClipAsset> clips{};
|
std::vector<SHAnimClipAsset*> clips{};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,19 +66,19 @@ namespace SHADE
|
||||||
|
|
||||||
for (auto const& clip : anim.clips)
|
for (auto const& clip : anim.clips)
|
||||||
{
|
{
|
||||||
uint32_t charCount {static_cast<uint32_t>(clip.name.size())};
|
uint32_t charCount {static_cast<uint32_t>(clip->name.size())};
|
||||||
file.write(
|
file.write(
|
||||||
reinterpret_cast<char const*>(&charCount),
|
reinterpret_cast<char const*>(&charCount),
|
||||||
sizeof(uint32_t)
|
sizeof(uint32_t)
|
||||||
);
|
);
|
||||||
|
|
||||||
file.write(
|
file.write(
|
||||||
clip.name.data(),
|
clip->name.data(),
|
||||||
charCount
|
charCount
|
||||||
);
|
);
|
||||||
|
|
||||||
file.write(
|
file.write(
|
||||||
reinterpret_cast<char const*>(&clip.firstIndex),
|
reinterpret_cast<char const*>(&clip->firstIndex),
|
||||||
sizeof(uint32_t) * 2
|
sizeof(uint32_t) * 2
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -99,28 +99,29 @@ namespace SHADE
|
||||||
reinterpret_cast<char*>(&size),
|
reinterpret_cast<char*>(&size),
|
||||||
sizeof(uint32_t)
|
sizeof(uint32_t)
|
||||||
);
|
);
|
||||||
|
data->clips.resize(size);
|
||||||
|
|
||||||
for (auto i{0}; i < size; ++i)
|
for (auto& clip : data->clips)
|
||||||
{
|
{
|
||||||
auto& clip {data->clips.emplace_back()};
|
clip = new SHAnimClipAsset;
|
||||||
uint32_t charCount;
|
uint32_t charCount;
|
||||||
file.read(
|
file.read(
|
||||||
reinterpret_cast<char*>(&charCount),
|
reinterpret_cast<char*>(&charCount),
|
||||||
sizeof(uint32_t)
|
sizeof(uint32_t)
|
||||||
);
|
);
|
||||||
|
|
||||||
clip.name.resize(charCount);
|
clip->name.resize(charCount);
|
||||||
file.read(
|
file.read(
|
||||||
clip.name.data(),
|
clip->name.data(),
|
||||||
charCount
|
charCount
|
||||||
);
|
);
|
||||||
|
|
||||||
file.read(
|
file.read(
|
||||||
reinterpret_cast<char*>(&clip.firstIndex),
|
reinterpret_cast<char*>(&clip->firstIndex),
|
||||||
sizeof(uint32_t) * 2
|
sizeof(uint32_t) * 2
|
||||||
);
|
);
|
||||||
|
|
||||||
clip.animRawDataAssetId = data->animRawDataAssetId;
|
clip->animRawDataAssetId = data->animRawDataAssetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = data;
|
result = data;
|
||||||
|
|
|
@ -314,10 +314,10 @@ namespace SHADE
|
||||||
.parent = parent
|
.parent = parent
|
||||||
};
|
};
|
||||||
auto& newClip {animContainer->clips.emplace_back()};
|
auto& newClip {animContainer->clips.emplace_back()};
|
||||||
newClip.name = name;
|
newClip->name = name;
|
||||||
assetCollection.emplace(id, asset);
|
assetCollection.emplace(id, asset);
|
||||||
assetCollection[parent].subAssets.push_back(&assetCollection[id]);
|
assetCollection[parent].subAssets.push_back(&assetCollection[id]);
|
||||||
assetData.emplace(id, &newClip);
|
assetData.emplace(id, newClip);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,6 +639,25 @@ namespace SHADE
|
||||||
assetData.emplace(asset.id, data);
|
assetData.emplace(asset.id, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (asset.type)
|
||||||
|
{
|
||||||
|
case AssetType::ANIM_CONTAINER:
|
||||||
|
{
|
||||||
|
auto container = reinterpret_cast<SHAnimClipContainerAsset*>(data);
|
||||||
|
for (auto i{0}; i < asset.subAssets.size(); ++i)
|
||||||
|
{
|
||||||
|
assetData.emplace(
|
||||||
|
asset.subAssets[i]->id,
|
||||||
|
container->clips[i]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -646,7 +665,6 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
auto const& parent = assetCollection[asset.parent];
|
auto const& parent = assetCollection[asset.parent];
|
||||||
auto parentData = loaders[static_cast<size_t>(parent.type)]->Load(parent.path);
|
auto parentData = loaders[static_cast<size_t>(parent.type)]->Load(parent.path);
|
||||||
|
|
||||||
if (parentData == nullptr)
|
if (parentData == nullptr)
|
||||||
{
|
{
|
||||||
SHLOG_ERROR("[Asset Manager] Unable to load asset into memory: {}\n", parent.path.string());
|
SHLOG_ERROR("[Asset Manager] Unable to load asset into memory: {}\n", parent.path.string());
|
||||||
|
@ -676,7 +694,7 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
assetData.emplace(
|
assetData.emplace(
|
||||||
parent.subAssets[i]->id,
|
parent.subAssets[i]->id,
|
||||||
&parentContainer->clips[i]
|
parentContainer->clips[i]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -859,7 +877,7 @@ namespace SHADE
|
||||||
for(auto& clip : data->clips)
|
for(auto& clip : data->clips)
|
||||||
{
|
{
|
||||||
SHAsset subAsset{
|
SHAsset subAsset{
|
||||||
.name = clip.name,
|
.name = clip->name,
|
||||||
.id = GenerateAssetID(AssetType::ANIM_CLIP),
|
.id = GenerateAssetID(AssetType::ANIM_CLIP),
|
||||||
.type = AssetType::ANIM_CLIP,
|
.type = AssetType::ANIM_CLIP,
|
||||||
.isSubAsset = true,
|
.isSubAsset = true,
|
||||||
|
@ -869,7 +887,7 @@ namespace SHADE
|
||||||
assetCollection.emplace(subAsset.id, subAsset);
|
assetCollection.emplace(subAsset.id, subAsset);
|
||||||
assetCollection[newAsset.id].subAssets.push_back(&assetCollection[subAsset.id]);
|
assetCollection[newAsset.id].subAssets.push_back(&assetCollection[subAsset.id]);
|
||||||
|
|
||||||
assetData.emplace(subAsset.id, &clip);
|
assetData.emplace(subAsset.id, clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
SHAssetMetaHandler::WriteMetaData(assetCollection[newAsset.id]);
|
SHAssetMetaHandler::WriteMetaData(assetCollection[newAsset.id]);
|
||||||
|
|
|
@ -280,7 +280,7 @@ namespace SHADE
|
||||||
|
|
||||||
|
|
||||||
if (arm->lookAtCameraOrigin)
|
if (arm->lookAtCameraOrigin)
|
||||||
CameraLookAt(camera, camera.position + arm->GetTargetOffset());
|
CameraLookAt(camera, camera.position + tOffset);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,8 +158,11 @@ namespace SHADE
|
||||||
if (SHEditorUI::CollapsingHeader("Existing Animation Clips"))
|
if (SHEditorUI::CollapsingHeader("Existing Animation Clips"))
|
||||||
{
|
{
|
||||||
ImGui::Indent();
|
ImGui::Indent();
|
||||||
|
int i = 0;
|
||||||
for (auto animClip : childAnimClips)
|
for (auto animClip : childAnimClips)
|
||||||
{
|
{
|
||||||
|
ImGui::PushID(i++);
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
std::optional<std::string> animClipName = SHResourceManager::GetAssetName<SHAnimationClip>(animClip);
|
std::optional<std::string> animClipName = SHResourceManager::GetAssetName<SHAnimationClip>(animClip);
|
||||||
|
|
||||||
|
@ -191,12 +194,14 @@ namespace SHADE
|
||||||
auto assetId = SHResourceManager::GetAssetID(animClip);
|
auto assetId = SHResourceManager::GetAssetID(animClip);
|
||||||
if (assetId.has_value())
|
if (assetId.has_value())
|
||||||
{
|
{
|
||||||
auto animAsset = SHAssetManager::GetData<SHAnimClipAsset>(assetId.value());
|
auto const animAsset = SHAssetManager::GetData<SHAnimClipAsset>(assetId.value());
|
||||||
animAsset->firstIndex = firstIndex;
|
animAsset->firstIndex = firstIndex;
|
||||||
animAsset->lastIndex = endIndex;
|
animAsset->lastIndex = endIndex;
|
||||||
SHAssetManager::SaveAsset(assetId.value());
|
SHAssetManager::SaveAsset(containerAsset->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extra separator if there is more than one
|
// Extra separator if there is more than one
|
||||||
|
|
|
@ -113,14 +113,15 @@ namespace SHADE
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHAssetBrowser>();
|
SHEditorWindowManager::CreateEditorWindow<SHAssetBrowser>();
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHMaterialInspector>();
|
SHEditorWindowManager::CreateEditorWindow<SHMaterialInspector>();
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHColliderTagPanel>();
|
SHEditorWindowManager::CreateEditorWindow<SHColliderTagPanel>();
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHHierarchyPanel>();
|
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHInputBindingsPanel>();
|
SHEditorWindowManager::CreateEditorWindow<SHInputBindingsPanel>();
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHEditorInspector>();
|
|
||||||
|
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHEditorViewport>();
|
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHAnimationControllerEditor>();
|
SHEditorWindowManager::CreateEditorWindow<SHAnimationControllerEditor>();
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHRawAnimInspector>();
|
SHEditorWindowManager::CreateEditorWindow<SHRawAnimInspector>();
|
||||||
|
|
||||||
|
SHEditorWindowManager::CreateEditorWindow<SHHierarchyPanel>();
|
||||||
|
SHEditorWindowManager::CreateEditorWindow<SHEditorViewport>();
|
||||||
|
SHEditorWindowManager::CreateEditorWindow<SHEditorInspector>();
|
||||||
|
|
||||||
//Add popup windows
|
//Add popup windows
|
||||||
SHEditorWindowManager::CreatePopupWindow<SHSceneSavePrompt>();
|
SHEditorWindowManager::CreatePopupWindow<SHSceneSavePrompt>();
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,17 @@ namespace SHADE
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public value struct AnimationClipAsset
|
public value struct AnimationClipAsset
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* Operator Overloads */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Implicit conversion operator to enable checking if a AnimationClip is valid.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gameObj">Asset to check.</param>
|
||||||
|
/// <returns>True if the Asset is valid.</returns>
|
||||||
|
static operator bool(AnimationClipAsset asset);
|
||||||
|
|
||||||
internal:
|
internal:
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Properties */
|
/* Properties */
|
||||||
|
@ -57,16 +68,6 @@ namespace SHADE
|
||||||
/// <param name="AnimationClipId">AssetID to the AnimationClip asset.</param>
|
/// <param name="AnimationClipId">AssetID to the AnimationClip asset.</param>
|
||||||
AnimationClipAsset(AssetID AnimationClipId);
|
AnimationClipAsset(AssetID AnimationClipId);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
|
||||||
/* Operator Overloads */
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
|
||||||
/// <summary>
|
|
||||||
/// Implicit conversion operator to enable checking if a AnimationClip is valid.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="gameObj">Asset to check.</param>
|
|
||||||
/// <returns>True if the Asset is valid.</returns>
|
|
||||||
static operator bool(AnimationClipAsset asset);
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Conversion Operators */
|
/* Conversion Operators */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -28,7 +28,18 @@ namespace SHADE
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public value struct AnimationControllerAsset
|
public value struct AnimationControllerAsset
|
||||||
{
|
{
|
||||||
internal:
|
public:
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* Operator Overloads */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Implicit conversion operator to enable checking if a AnimationController is valid.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gameObj">Asset to check.</param>
|
||||||
|
/// <returns>True if the Asset is valid.</returns>
|
||||||
|
static operator bool(AnimationControllerAsset asset);
|
||||||
|
|
||||||
|
internal:
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Properties */
|
/* Properties */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
@ -56,16 +67,6 @@ namespace SHADE
|
||||||
/// <param name="AnimationControllerId">AssetID to the AnimationController asset.</param>
|
/// <param name="AnimationControllerId">AssetID to the AnimationController asset.</param>
|
||||||
AnimationControllerAsset(AssetID AnimationControllerId);
|
AnimationControllerAsset(AssetID AnimationControllerId);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
|
||||||
/* Operator Overloads */
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
|
||||||
/// <summary>
|
|
||||||
/// Implicit conversion operator to enable checking if a AnimationController is valid.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="gameObj">Asset to check.</param>
|
|
||||||
/// <returns>True if the Asset is valid.</returns>
|
|
||||||
static operator bool(AnimationControllerAsset asset);
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Conversion Operators */
|
/* Conversion Operators */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -28,6 +28,17 @@ namespace SHADE
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public value struct AnimationRigAsset
|
public value struct AnimationRigAsset
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* Operator Overloads */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Implicit conversion operator to enable checking if a AnimationRig is valid.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gameObj">Asset to check.</param>
|
||||||
|
/// <returns>True if the Asset is valid.</returns>
|
||||||
|
static operator bool(AnimationRigAsset asset);
|
||||||
|
|
||||||
internal:
|
internal:
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Properties */
|
/* Properties */
|
||||||
|
@ -56,16 +67,6 @@ namespace SHADE
|
||||||
/// <param name="AnimationRigId">AssetID to the AnimationRig asset.</param>
|
/// <param name="AnimationRigId">AssetID to the AnimationRig asset.</param>
|
||||||
AnimationRigAsset(AssetID AnimationRigId);
|
AnimationRigAsset(AssetID AnimationRigId);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
|
||||||
/* Operator Overloads */
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
|
||||||
/// <summary>
|
|
||||||
/// Implicit conversion operator to enable checking if a AnimationRig is valid.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="gameObj">Asset to check.</param>
|
|
||||||
/// <returns>True if the Asset is valid.</returns>
|
|
||||||
static operator bool(AnimationRigAsset asset);
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Conversion Operators */
|
/* Conversion Operators */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -28,6 +28,17 @@ namespace SHADE
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public value struct FontAsset
|
public value struct FontAsset
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* Operator Overloads */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Implicit conversion operator to enable checking if a Font is valid.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gameObj">Asset to check.</param>
|
||||||
|
/// <returns>True if the Asset is valid.</returns>
|
||||||
|
static operator bool(FontAsset asset);
|
||||||
|
|
||||||
internal:
|
internal:
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Properties */
|
/* Properties */
|
||||||
|
@ -56,16 +67,6 @@ namespace SHADE
|
||||||
/// <param name="fontId">AssetID to the font asset.</param>
|
/// <param name="fontId">AssetID to the font asset.</param>
|
||||||
FontAsset(AssetID fontId);
|
FontAsset(AssetID fontId);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
|
||||||
/* Operator Overloads */
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
|
||||||
/// <summary>
|
|
||||||
/// Implicit conversion operator to enable checking if a Font is valid.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="gameObj">Asset to check.</param>
|
|
||||||
/// <returns>True if the Asset is valid.</returns>
|
|
||||||
static operator bool(FontAsset asset);
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Conversion Operators */
|
/* Conversion Operators */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -28,6 +28,17 @@ namespace SHADE
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public value struct MaterialAsset
|
public value struct MaterialAsset
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* Operator Overloads */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Implicit conversion operator to enable checking if a Material is valid.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gameObj">Asset to check.</param>
|
||||||
|
/// <returns>True if the Asset is valid.</returns>
|
||||||
|
static operator bool(MaterialAsset asset);
|
||||||
|
|
||||||
internal:
|
internal:
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Properties */
|
/* Properties */
|
||||||
|
@ -56,16 +67,6 @@ namespace SHADE
|
||||||
/// <param name="MaterialId">AssetID to the Material asset.</param>
|
/// <param name="MaterialId">AssetID to the Material asset.</param>
|
||||||
MaterialAsset(AssetID MaterialId);
|
MaterialAsset(AssetID MaterialId);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
|
||||||
/* Operator Overloads */
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
|
||||||
/// <summary>
|
|
||||||
/// Implicit conversion operator to enable checking if a Material is valid.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="gameObj">Asset to check.</param>
|
|
||||||
/// <returns>True if the Asset is valid.</returns>
|
|
||||||
static operator bool(MaterialAsset asset);
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Conversion Operators */
|
/* Conversion Operators */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -28,7 +28,18 @@ namespace SHADE
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public value struct MeshAsset
|
public value struct MeshAsset
|
||||||
{
|
{
|
||||||
internal:
|
public:
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* Operator Overloads */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Implicit conversion operator to enable checking if a Mesh is valid.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gameObj">Asset to check.</param>
|
||||||
|
/// <returns>True if the Asset is valid.</returns>
|
||||||
|
static operator bool(MeshAsset asset);
|
||||||
|
|
||||||
|
internal:
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Properties */
|
/* Properties */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
@ -56,16 +67,6 @@ namespace SHADE
|
||||||
/// <param name="meshId">AssetID to the Mesh asset.</param>
|
/// <param name="meshId">AssetID to the Mesh asset.</param>
|
||||||
MeshAsset(AssetID meshId);
|
MeshAsset(AssetID meshId);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
|
||||||
/* Operator Overloads */
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
|
||||||
/// <summary>
|
|
||||||
/// Implicit conversion operator to enable checking if a Mesh is valid.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="gameObj">Asset to check.</param>
|
|
||||||
/// <returns>True if the Asset is valid.</returns>
|
|
||||||
static operator bool(MeshAsset asset);
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Conversion Operators */
|
/* Conversion Operators */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/************************************************************************************//*!
|
||||||
|
\file AnimationSystem.cxx
|
||||||
|
\author Tng Kah Wei, kahwei.tng, 390009620
|
||||||
|
\par email: kahwei.tng\@digipen.edu
|
||||||
|
\date Mar 10, 2023
|
||||||
|
\brief Contains the definition of the functions of the managed AnimationSystem
|
||||||
|
static class.
|
||||||
|
|
||||||
|
Note: This file is written in C++17/CLI.
|
||||||
|
|
||||||
|
Copyright (C) 2023 DigiPen Institute of Technology.
|
||||||
|
Reproduction or disclosure of this file or its contents without the prior written consent
|
||||||
|
of DigiPen Institute of Technology is prohibited.
|
||||||
|
*//*************************************************************************************/
|
||||||
|
// Precompiled Headers
|
||||||
|
#include "SHpch.h"
|
||||||
|
// Primary Header
|
||||||
|
#include "AnimationSystem.hxx"
|
||||||
|
// External Dependencies
|
||||||
|
#include "ECS_Base/Managers/SHSystemManager.h"
|
||||||
|
|
||||||
|
namespace SHADE
|
||||||
|
{
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* Properties */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
double AnimationSystem::TimeScale::get()
|
||||||
|
{
|
||||||
|
auto sys = SHSystemManager::GetSystem<SHAnimationSystem>();
|
||||||
|
return sys->TimeScale;
|
||||||
|
}
|
||||||
|
void AnimationSystem::TimeScale::set(double value)
|
||||||
|
{
|
||||||
|
auto sys = SHSystemManager::GetSystem<SHAnimationSystem>();
|
||||||
|
sys->TimeScale = value;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
/************************************************************************************//*!
|
||||||
|
\file AnimationSystem.hxx
|
||||||
|
\author Tng Kah Wei, kahwei.tng, 390009620
|
||||||
|
\par email: kahwei.tng\@digipen.edu
|
||||||
|
\date Mar 10, 2023
|
||||||
|
\brief Contains the definition of the managed AnimationSystem static class.
|
||||||
|
|
||||||
|
Note: This file is written in C++17/CLI.
|
||||||
|
|
||||||
|
Copyright (C) 2023 DigiPen Institute of Technology.
|
||||||
|
Reproduction or disclosure of this file or its contents without the prior written consent
|
||||||
|
of DigiPen Institute of Technology is prohibited.
|
||||||
|
*//*************************************************************************************/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Animation/SHAnimationSystem.h"
|
||||||
|
|
||||||
|
namespace SHADE
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Static class for interfacing with the animation system.
|
||||||
|
/// </summary>
|
||||||
|
public ref class AnimationSystem abstract sealed
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* Constants */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Default time scale used by the system.
|
||||||
|
/// </summary>
|
||||||
|
literal double DefaultTimeScale = SHAnimationSystem::DEFAULT_TIME_SCALE;
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* Properties */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Used by the system to multiply the given delta time to scale the animation
|
||||||
|
/// speed.
|
||||||
|
/// </summary>
|
||||||
|
static property double TimeScale
|
||||||
|
{
|
||||||
|
double get();
|
||||||
|
void set(double value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue