Merge branch 'main' into SP3-10-input-management
This commit is contained in:
commit
bc87fa3ae0
|
@ -1,4 +1,4 @@
|
||||||
Start Maximized: true
|
Start Maximized: true
|
||||||
Working Scene ID: 86098106
|
Working Scene ID: 97158628
|
||||||
Window Size: {x: 1920, y: 1013}
|
Window Size: {x: 1920, y: 1013}
|
||||||
Style: 0
|
Style: 0
|
|
@ -9567,10 +9567,17 @@
|
||||||
maxMultiplierDuration: 5
|
maxMultiplierDuration: 5
|
||||||
maxMultiplierCombo: 10
|
maxMultiplierCombo: 10
|
||||||
multiplierFont: 60
|
multiplierFont: 60
|
||||||
|
- Type: PauseMenu
|
||||||
|
Enabled: true
|
||||||
|
resumeBtn: 8
|
||||||
|
retryBtn: 461
|
||||||
|
quitBtn: 0
|
||||||
|
gamePauseText: 11
|
||||||
|
canvas: 10
|
||||||
- EID: 199
|
- EID: 199
|
||||||
Name: =====Text====
|
Name: =====Text====
|
||||||
IsActive: true
|
IsActive: true
|
||||||
NumberOfChildren: 3
|
NumberOfChildren: 4
|
||||||
Components: ~
|
Components: ~
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 237
|
- EID: 237
|
||||||
|
@ -9618,6 +9625,21 @@
|
||||||
Font: 176667660
|
Font: 176667660
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
|
- EID: 11
|
||||||
|
Name: GamePause
|
||||||
|
IsActive: true
|
||||||
|
NumberOfChildren: 0
|
||||||
|
Components:
|
||||||
|
Transform Component:
|
||||||
|
Translate: {x: -250, y: 300, z: 0}
|
||||||
|
Rotate: {x: 0, y: 0, z: 0}
|
||||||
|
Scale: {x: 100, y: 100, z: 100}
|
||||||
|
IsActive: true
|
||||||
|
Text Renderer Component:
|
||||||
|
Text: Game Pause
|
||||||
|
Font: 176667660
|
||||||
|
IsActive: false
|
||||||
|
Scripts: ~
|
||||||
- EID: 198
|
- EID: 198
|
||||||
Name: ====Raccoon====
|
Name: ====Raccoon====
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -9676,18 +9698,21 @@
|
||||||
maxJumpHeight: 2
|
maxJumpHeight: 2
|
||||||
maxJumpTime: 0.75
|
maxJumpTime: 0.75
|
||||||
fallMultipler: 3
|
fallMultipler: 3
|
||||||
lightMultiper: 0.75
|
jumpPadMultiplayer: 1.20000005
|
||||||
mediumMultiper: 0.5
|
lightMultiper: 0.899999976
|
||||||
heavyMultiper: 0.25
|
mediumMultiper: 0.699999988
|
||||||
|
heavyMultiper: 0.5
|
||||||
- Type: PickAndThrow
|
- Type: PickAndThrow
|
||||||
Enabled: true
|
Enabled: true
|
||||||
throwForce: [10, 8, 10]
|
throwForce: [10, 8, 10]
|
||||||
cameraArmOffSet: [0, 0.25, 0]
|
cameraArmOffSet: [0.25, 0.600000024, 0.200000003]
|
||||||
delayTimer: 1
|
delayTimer: 1
|
||||||
aimingLength: 1
|
aimingLength: 1
|
||||||
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
|
||||||
|
@ -9714,30 +9739,31 @@
|
||||||
Pitch: 0
|
Pitch: 0
|
||||||
Yaw: 360
|
Yaw: 360
|
||||||
Roll: 1.28065994e-06
|
Roll: 1.28065994e-06
|
||||||
Width: 1920
|
Width: 2560
|
||||||
Height: 1080
|
Height: 1369
|
||||||
Near: 0.00999999978
|
Near: 0.00999999978
|
||||||
Far: 10000
|
Far: 10000
|
||||||
Perspective: true
|
Perspective: true
|
||||||
|
FOV: 45
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Camera Arm Component:
|
Camera Arm Component:
|
||||||
Arm Pitch: 0
|
Arm Pitch: 0
|
||||||
Arm Yaw: 0
|
Arm Yaw: 0
|
||||||
Arm Length: 3
|
Arm Length: 3
|
||||||
Look At Camera Origin: true
|
Look At Camera Origin: true
|
||||||
Target Offset: {x: 0, y: 0, z: 0}
|
Target Offset: {x: 0, y: 0.75, z: 0}
|
||||||
Camera Collision: true
|
Camera Collision: true
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: SHADE_Scripting.ThirdPersonCamera
|
- Type: SHADE_Scripting.ThirdPersonCamera
|
||||||
Enabled: true
|
Enabled: true
|
||||||
armLength: 3
|
armLength: 3
|
||||||
turnSpeedPitch: 0.300000012
|
turnSpeedPitch: 0.200000003
|
||||||
turnSpeedYaw: 0.5
|
turnSpeedYaw: 0.400000006
|
||||||
pitchClamp: 45
|
|
||||||
inverseXControls: false
|
inverseXControls: false
|
||||||
inverseYControls: true
|
inverseYControls: false
|
||||||
lowerClamp: 5
|
pitchUpperClamp: 45
|
||||||
|
pitchLowerClamp: 5
|
||||||
- EID: 9
|
- EID: 9
|
||||||
Name: PlayerBag
|
Name: PlayerBag
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -10489,11 +10515,11 @@
|
||||||
Translate: {x: 2.70000005, y: 0.100000001, z: -2}
|
Translate: {x: 2.70000005, y: 0.100000001, z: -2}
|
||||||
Rotate: {x: -0, y: 0, z: -0}
|
Rotate: {x: -0, y: 0, z: -0}
|
||||||
Scale: {x: 1, y: 1, z: 1}
|
Scale: {x: 1, y: 1, z: 1}
|
||||||
IsActive: true
|
IsActive: false
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
Mesh: 140697366
|
Mesh: 140697366
|
||||||
Material: 129495479
|
Material: 129495479
|
||||||
IsActive: true
|
IsActive: false
|
||||||
RigidBody Component:
|
RigidBody Component:
|
||||||
Type: Dynamic
|
Type: Dynamic
|
||||||
Drag: 0.00999999978
|
Drag: 0.00999999978
|
||||||
|
@ -10507,7 +10533,7 @@
|
||||||
Freeze Rotation X: true
|
Freeze Rotation X: true
|
||||||
Freeze Rotation Y: false
|
Freeze Rotation Y: false
|
||||||
Freeze Rotation Z: true
|
Freeze Rotation Z: true
|
||||||
IsActive: true
|
IsActive: false
|
||||||
Collider Component:
|
Collider Component:
|
||||||
Colliders:
|
Colliders:
|
||||||
- Is Trigger: false
|
- Is Trigger: false
|
||||||
|
@ -10519,7 +10545,7 @@
|
||||||
Density: 1
|
Density: 1
|
||||||
Position Offset: {x: 0, y: 0.899999976, z: 0}
|
Position Offset: {x: 0, y: 0.899999976, z: 0}
|
||||||
Rotation Offset: {x: 0, y: 0, z: 0}
|
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||||
IsActive: true
|
IsActive: false
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: Homeowner1
|
- Type: Homeowner1
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
@ -10532,3 +10558,154 @@
|
||||||
distanceToCapture: 0.5
|
distanceToCapture: 0.5
|
||||||
captureTime: 0.5
|
captureTime: 0.5
|
||||||
footstepSFXIntervalMultiplier: 0.5
|
footstepSFXIntervalMultiplier: 0.5
|
||||||
|
- EID: 12
|
||||||
|
Name: Mesh_Meat
|
||||||
|
IsActive: true
|
||||||
|
NumberOfChildren: 0
|
||||||
|
Components:
|
||||||
|
Transform Component:
|
||||||
|
Translate: {x: 2.30459714, y: 0.209537908, z: 6.371418}
|
||||||
|
Rotate: {x: -0, y: 0, z: -0}
|
||||||
|
Scale: {x: 1, y: 1, z: 1}
|
||||||
|
IsActive: true
|
||||||
|
Renderable Component:
|
||||||
|
Mesh: 136892700
|
||||||
|
Material: 131956078
|
||||||
|
IsActive: true
|
||||||
|
RigidBody Component:
|
||||||
|
Type: Dynamic
|
||||||
|
Drag: 0.00999999978
|
||||||
|
Angular Drag: 0.100000001
|
||||||
|
Use Gravity: true
|
||||||
|
Interpolate: false
|
||||||
|
Sleeping Enabled: true
|
||||||
|
Freeze Position X: false
|
||||||
|
Freeze Position Y: false
|
||||||
|
Freeze Position Z: false
|
||||||
|
Freeze Rotation X: false
|
||||||
|
Freeze Rotation Y: false
|
||||||
|
Freeze Rotation Z: false
|
||||||
|
IsActive: true
|
||||||
|
Collider Component:
|
||||||
|
Colliders:
|
||||||
|
- Is Trigger: false
|
||||||
|
Collision Tag: 2
|
||||||
|
Type: Box
|
||||||
|
Half Extents: {x: 0.300000012, y: 0.300000012, z: 0.300000012}
|
||||||
|
Friction: 0.400000006
|
||||||
|
Bounciness: 0
|
||||||
|
Density: 1
|
||||||
|
Position Offset: {x: 0, y: 0, z: 0}
|
||||||
|
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||||
|
IsActive: true
|
||||||
|
Scripts:
|
||||||
|
- Type: Item
|
||||||
|
Enabled: true
|
||||||
|
Score: 50
|
||||||
|
currCategory: 1
|
||||||
|
density: 1
|
||||||
|
dontReturn: false
|
||||||
|
- EID: 16
|
||||||
|
Name: JumpPad
|
||||||
|
IsActive: false
|
||||||
|
NumberOfChildren: 0
|
||||||
|
Components:
|
||||||
|
Transform Component:
|
||||||
|
Translate: {x: 3.43332767, y: 0.149463654, z: 6.84711409}
|
||||||
|
Rotate: {x: -0, y: 0, z: -0}
|
||||||
|
Scale: {x: 1, y: 1, z: 1}
|
||||||
|
IsActive: false
|
||||||
|
Collider Component:
|
||||||
|
Colliders:
|
||||||
|
- Is Trigger: false
|
||||||
|
Collision Tag: 1
|
||||||
|
Type: Box
|
||||||
|
Half Extents: {x: 1, y: 0.25, z: 1}
|
||||||
|
Friction: 0.400000006
|
||||||
|
Bounciness: 0
|
||||||
|
Density: 1
|
||||||
|
Position Offset: {x: 0, y: 0, z: 0}
|
||||||
|
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||||
|
IsActive: false
|
||||||
|
Scripts:
|
||||||
|
- Type: JumpPad
|
||||||
|
Enabled: true
|
||||||
|
- EID: 10
|
||||||
|
Name: Canvas
|
||||||
|
IsActive: false
|
||||||
|
NumberOfChildren: 3
|
||||||
|
Components:
|
||||||
|
Canvas Component:
|
||||||
|
Canvas Width: 1920
|
||||||
|
Canvas Height: 1080
|
||||||
|
IsActive: false
|
||||||
|
Scripts: ~
|
||||||
|
- EID: 8
|
||||||
|
Name: ResumeButton
|
||||||
|
IsActive: true
|
||||||
|
NumberOfChildren: 0
|
||||||
|
Components:
|
||||||
|
Transform Component:
|
||||||
|
Translate: {x: 0, y: 100, z: 0}
|
||||||
|
Rotate: {x: 0, y: 0, z: 0}
|
||||||
|
Scale: {x: 300, y: 200, z: 500}
|
||||||
|
IsActive: true
|
||||||
|
Renderable Component:
|
||||||
|
Mesh: 141771688
|
||||||
|
Material: 129340704
|
||||||
|
IsActive: true
|
||||||
|
Button Component:
|
||||||
|
Default Texture: 52901020
|
||||||
|
Hovered Texture: 62235279
|
||||||
|
Clicked Texture: 64722619
|
||||||
|
IsActive: true
|
||||||
|
UI Component:
|
||||||
|
Canvas ID: 10
|
||||||
|
IsActive: true
|
||||||
|
Scripts: ~
|
||||||
|
- EID: 0
|
||||||
|
Name: QuitButton
|
||||||
|
IsActive: true
|
||||||
|
NumberOfChildren: 0
|
||||||
|
Components:
|
||||||
|
Transform Component:
|
||||||
|
Translate: {x: 0, y: -300, z: 0}
|
||||||
|
Rotate: {x: 0, y: 0, z: 0}
|
||||||
|
Scale: {x: 300, y: 200, z: 500}
|
||||||
|
IsActive: true
|
||||||
|
Renderable Component:
|
||||||
|
Mesh: 141771688
|
||||||
|
Material: 129340704
|
||||||
|
IsActive: true
|
||||||
|
Button Component:
|
||||||
|
Default Texture: 66477839
|
||||||
|
Hovered Texture: 65045286
|
||||||
|
Clicked Texture: 58607560
|
||||||
|
IsActive: true
|
||||||
|
UI Component:
|
||||||
|
Canvas ID: 10
|
||||||
|
IsActive: true
|
||||||
|
Scripts: ~
|
||||||
|
- EID: 461
|
||||||
|
Name: RetryButton
|
||||||
|
IsActive: true
|
||||||
|
NumberOfChildren: 0
|
||||||
|
Components:
|
||||||
|
Transform Component:
|
||||||
|
Translate: {x: 0, y: -100, z: 0}
|
||||||
|
Rotate: {x: 0, y: 0, z: 0}
|
||||||
|
Scale: {x: 300, y: 200, z: 500}
|
||||||
|
IsActive: true
|
||||||
|
Renderable Component:
|
||||||
|
Mesh: 141771688
|
||||||
|
Material: 129340704
|
||||||
|
IsActive: true
|
||||||
|
Button Component:
|
||||||
|
Default Texture: 55782622
|
||||||
|
Hovered Texture: 58972174
|
||||||
|
Clicked Texture: 55224464
|
||||||
|
IsActive: true
|
||||||
|
UI Component:
|
||||||
|
Canvas ID: 10
|
||||||
|
IsActive: true
|
||||||
|
Scripts: ~
|
|
@ -6,6 +6,7 @@
|
||||||
Canvas Component:
|
Canvas Component:
|
||||||
Canvas Width: 1920
|
Canvas Width: 1920
|
||||||
Canvas Height: 1080
|
Canvas Height: 1080
|
||||||
|
Scale by canvas width: false
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 1
|
- EID: 1
|
||||||
|
@ -24,6 +25,8 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 0
|
Canvas ID: 0
|
||||||
|
Hovered: false
|
||||||
|
Clicked: false
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 5
|
- EID: 5
|
||||||
|
@ -47,6 +50,8 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 0
|
Canvas ID: 0
|
||||||
|
Hovered: false
|
||||||
|
Clicked: false
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: ChangeSceneButton
|
- Type: ChangeSceneButton
|
||||||
|
@ -73,6 +78,8 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 0
|
Canvas ID: 0
|
||||||
|
Hovered: false
|
||||||
|
Clicked: false
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: QuitButton
|
- Type: QuitButton
|
||||||
|
@ -106,11 +113,12 @@
|
||||||
Pitch: 0
|
Pitch: 0
|
||||||
Yaw: 0
|
Yaw: 0
|
||||||
Roll: 0
|
Roll: 0
|
||||||
Width: 1920
|
Width: 1319
|
||||||
Height: 1080
|
Height: 622
|
||||||
Near: 0.00999999978
|
Near: 0.00999999978
|
||||||
Far: 10000
|
Far: 10000
|
||||||
Perspective: true
|
Perspective: true
|
||||||
|
FOV: 90
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 4
|
- EID: 4
|
||||||
|
|
|
@ -19,5 +19,13 @@ namespace SHADE_Scripting.Audio
|
||||||
h.Value.Stop(fadeOut);
|
h.Value.Stop(fadeOut);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void pauseAllSounds(bool pause)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<string, AudioClipHandler> h in audioClipHandlers)
|
||||||
|
{
|
||||||
|
h.Value.SetPause(pause);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ using static Item;
|
||||||
|
|
||||||
public class PickAndThrow : Script
|
public class PickAndThrow : Script
|
||||||
{
|
{
|
||||||
public Vector3 throwForce = new Vector3(100.0f, 200.0f, 100.0f);
|
public Vector3 throwForce = new Vector3(10.0f, 8.0f, 10.0f);
|
||||||
public Vector3 cameraArmOffSet = new Vector3(0.0f, 0.25f, 0.0f);
|
public Vector3 cameraArmOffSet = new Vector3(0.0f, 0.25f, 0.0f);
|
||||||
public GameObject item { get; set; }
|
public GameObject item { get; set; }
|
||||||
public float delayTimer = 1.0f;
|
public float delayTimer = 1.0f;
|
||||||
|
@ -33,6 +33,9 @@ public class PickAndThrow : Script
|
||||||
[Tooltip("Height of ray")]
|
[Tooltip("Height of ray")]
|
||||||
public float rayHeight = 0.1f;
|
public float rayHeight = 0.1f;
|
||||||
|
|
||||||
|
public float aimingFOV = 50;
|
||||||
|
public float defaultFOV = 45;
|
||||||
|
|
||||||
protected override void awake()
|
protected override void awake()
|
||||||
{
|
{
|
||||||
pc = GetScript<PlayerController>();
|
pc = GetScript<PlayerController>();
|
||||||
|
@ -74,6 +77,7 @@ public class PickAndThrow : Script
|
||||||
pc.isAiming = true;
|
pc.isAiming = true;
|
||||||
pc.camArm.ArmLength = aimingLength;
|
pc.camArm.ArmLength = aimingLength;
|
||||||
pc.camArm.TargetOffset = cameraArmOffSet;
|
pc.camArm.TargetOffset = cameraArmOffSet;
|
||||||
|
pc.cam.FOV = aimingFOV;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming)
|
if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming)
|
||||||
|
@ -83,6 +87,7 @@ public class PickAndThrow : Script
|
||||||
itemCollider.GetCollisionShape(0).IsTrigger = false;
|
itemCollider.GetCollisionShape(0).IsTrigger = false;
|
||||||
pc.isAiming = false;
|
pc.isAiming = false;
|
||||||
pc.camArm.TargetOffset = Vector3.Zero;
|
pc.camArm.TargetOffset = Vector3.Zero;
|
||||||
|
pc.cam.FOV = defaultFOV;
|
||||||
if (tpc)
|
if (tpc)
|
||||||
pc.camArm.ArmLength = tpc.armLength;
|
pc.camArm.ArmLength = tpc.armLength;
|
||||||
pc.holdItem = false;
|
pc.holdItem = false;
|
||||||
|
@ -103,6 +108,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.camArm.TargetOffset = Vector3.Zero;
|
pc.camArm.TargetOffset = Vector3.Zero;
|
||||||
if (tpc)
|
if (tpc)
|
||||||
pc.camArm.ArmLength = tpc.armLength;
|
pc.camArm.ArmLength = tpc.armLength;
|
||||||
|
@ -132,7 +138,7 @@ public class PickAndThrow : Script
|
||||||
{
|
{
|
||||||
if (itemScript)
|
if (itemScript)
|
||||||
{
|
{
|
||||||
Vector3 vec = new Vector3(throwForce.x * lastXDir, throwForce.y, throwForce.z * lastZDir);
|
Vector3 vec = new Vector3(throwForce.x * lastXDir, throwForce.y + (throwForce.y * GetPitchRatioRange()), throwForce.z * lastZDir);
|
||||||
if (itemScript.currCategory == ItemCategory.LIGHT)
|
if (itemScript.currCategory == ItemCategory.LIGHT)
|
||||||
itemRidigBody.AddForce(vec * 0.2f);
|
itemRidigBody.AddForce(vec * 0.2f);
|
||||||
if (itemScript.currCategory == ItemCategory.MEDIUM)
|
if (itemScript.currCategory == ItemCategory.MEDIUM)
|
||||||
|
@ -254,5 +260,10 @@ public class PickAndThrow : Script
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private float GetPitchRatioRange()
|
||||||
|
{
|
||||||
|
return (pc.camArm.Pitch - tpc.pitchUpperClamp) / (tpc.pitchLowerClamp - tpc.pitchUpperClamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -65,7 +65,7 @@ public class PlayerController : Script
|
||||||
//Jumping vars==================================================================
|
//Jumping vars==================================================================
|
||||||
[Tooltip("max height of the jump")]
|
[Tooltip("max height of the jump")]
|
||||||
public float maxJumpHeight = 1.0f;
|
public float maxJumpHeight = 1.0f;
|
||||||
[Tooltip("max amt of time it will take for the jump")]
|
[Tooltip("max amount of time it will take for the jump")]
|
||||||
public float maxJumpTime = 0.5f;
|
public float maxJumpTime = 0.5f;
|
||||||
[Tooltip("increase gravity when falling")]
|
[Tooltip("increase gravity when falling")]
|
||||||
public float fallMultipler = 3.0f;
|
public float fallMultipler = 3.0f;
|
||||||
|
@ -73,6 +73,9 @@ public class PlayerController : Script
|
||||||
private bool isGrounded = true;
|
private bool isGrounded = true;
|
||||||
private float gravity = -9.8f;
|
private float gravity = -9.8f;
|
||||||
private float groundGravity = -0.5f;
|
private float groundGravity = -0.5f;
|
||||||
|
public bool landedOnJumpPad { get; set; }
|
||||||
|
[Tooltip("multiply height on Jump Pad ")]
|
||||||
|
public float jumpPadMultiplayer = 2.0f;
|
||||||
|
|
||||||
//ItemMultipler==================================================================
|
//ItemMultipler==================================================================
|
||||||
[Tooltip("How light item will affect player jump")]
|
[Tooltip("How light item will affect player jump")]
|
||||||
|
@ -88,6 +91,7 @@ public class PlayerController : Script
|
||||||
isMoveKeyPress = false;
|
isMoveKeyPress = false;
|
||||||
holdItem = false;
|
holdItem = false;
|
||||||
isAiming = false;
|
isAiming = false;
|
||||||
|
landedOnJumpPad = false;
|
||||||
|
|
||||||
//Jump setup
|
//Jump setup
|
||||||
float timeToApex = maxJumpTime / 2;
|
float timeToApex = maxJumpTime / 2;
|
||||||
|
@ -287,7 +291,7 @@ public class PlayerController : Script
|
||||||
{
|
{
|
||||||
if (currentState == RaccoonStates.WALKING || currentState == RaccoonStates.RUNNING || currentState == RaccoonStates.IDLE)
|
if (currentState == RaccoonStates.WALKING || currentState == RaccoonStates.RUNNING || currentState == RaccoonStates.IDLE)
|
||||||
{
|
{
|
||||||
if (Input.GetKeyDown(Input.KeyCode.Space) && isGrounded && rb != null)
|
if ( (Input.GetKeyDown(Input.KeyCode.Space) || landedOnJumpPad ) && isGrounded && rb != null)
|
||||||
{
|
{
|
||||||
currentState = RaccoonStates.JUMP;
|
currentState = RaccoonStates.JUMP;
|
||||||
Vector3 v = rb.LinearVelocity;
|
Vector3 v = rb.LinearVelocity;
|
||||||
|
@ -302,6 +306,12 @@ public class PlayerController : Script
|
||||||
if (item != null && item.currCategory == ItemCategory.HEAVY)
|
if (item != null && item.currCategory == ItemCategory.HEAVY)
|
||||||
v.y *= heavyMultiper;
|
v.y *= heavyMultiper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (landedOnJumpPad)
|
||||||
|
{
|
||||||
|
v.y *= jumpPadMultiplayer;
|
||||||
|
landedOnJumpPad = false;
|
||||||
|
}
|
||||||
rb.LinearVelocity = v;
|
rb.LinearVelocity = v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,10 @@ namespace SHADE_Scripting
|
||||||
public float armLength = 2.0f;
|
public float armLength = 2.0f;
|
||||||
public float turnSpeedPitch = 0.3f;
|
public float turnSpeedPitch = 0.3f;
|
||||||
public float turnSpeedYaw = 0.5f;
|
public float turnSpeedYaw = 0.5f;
|
||||||
public float pitchClamp = 45.0f;
|
|
||||||
public bool inverseXControls = false;
|
public bool inverseXControls = false;
|
||||||
public bool inverseYControls = false;
|
public bool inverseYControls = false;
|
||||||
public float lowerClamp = 5.0f;
|
public float pitchUpperClamp = 45.0f;
|
||||||
|
public float pitchLowerClamp = 5.0f;
|
||||||
|
|
||||||
protected override void awake()
|
protected override void awake()
|
||||||
{
|
{
|
||||||
|
@ -51,17 +51,17 @@ namespace SHADE_Scripting
|
||||||
arm.Pitch += vel.y * turnSpeedPitch * Time.DeltaTimeF;
|
arm.Pitch += vel.y * turnSpeedPitch * Time.DeltaTimeF;
|
||||||
|
|
||||||
if (inverseXControls)
|
if (inverseXControls)
|
||||||
arm.Yaw -= vel.x * turnSpeedYaw * Time.DeltaTimeF;
|
|
||||||
else
|
|
||||||
arm.Yaw += vel.x * turnSpeedYaw * Time.DeltaTimeF;
|
arm.Yaw += vel.x * turnSpeedYaw * Time.DeltaTimeF;
|
||||||
|
else
|
||||||
|
arm.Yaw -= vel.x * turnSpeedYaw * Time.DeltaTimeF;
|
||||||
|
|
||||||
if (arm.Pitch > pitchClamp)
|
if (arm.Pitch > pitchUpperClamp)
|
||||||
{
|
{
|
||||||
arm.Pitch = pitchClamp;
|
arm.Pitch = pitchUpperClamp;
|
||||||
}
|
}
|
||||||
else if (arm.Pitch < lowerClamp)
|
else if (arm.Pitch < pitchLowerClamp)
|
||||||
{
|
{
|
||||||
arm.Pitch = lowerClamp;
|
arm.Pitch = pitchLowerClamp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,9 @@ public class GameManager : Script
|
||||||
private Vector3 fontScalar;
|
private Vector3 fontScalar;
|
||||||
|
|
||||||
public static GameManager Instance { get; private set; }
|
public static GameManager Instance { get; private set; }
|
||||||
|
//public static int highScore { get; private set; } maybe need
|
||||||
|
|
||||||
|
public bool GamePause { get; set; }
|
||||||
|
|
||||||
protected override void start()
|
protected override void start()
|
||||||
{
|
{
|
||||||
|
@ -83,7 +86,11 @@ public class GameManager : Script
|
||||||
|
|
||||||
protected override void update()
|
protected override void update()
|
||||||
{
|
{
|
||||||
Cheats();
|
if (GamePause)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (currGameState == GameState.START)
|
if (currGameState == GameState.START)
|
||||||
{
|
{
|
||||||
timer -= Time.DeltaTimeF;
|
timer -= Time.DeltaTimeF;
|
||||||
|
@ -140,15 +147,6 @@ public class GameManager : Script
|
||||||
Instance = null;
|
Instance = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Cheats()
|
|
||||||
{
|
|
||||||
if (Input.GetKeyDown(Input.KeyCode.Escape))
|
|
||||||
{
|
|
||||||
Audio.StopAllSounds();
|
|
||||||
SceneManager.ChangeScene(97158628);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ItemScored()
|
public void ItemScored()
|
||||||
{
|
{
|
||||||
totalItemCount -= 1;
|
totalItemCount -= 1;
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
using SHADE;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
public class JumpPad : Script
|
||||||
|
{
|
||||||
|
protected override void awake()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void update()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void onCollisionEnter(CollisionInfo info)
|
||||||
|
{
|
||||||
|
if (info.GameObject.GetScript<PlayerController>() && info.GameObject.GetScript<PlayerController>().currentState == PlayerController.RaccoonStates.FALLING)
|
||||||
|
{
|
||||||
|
info.GameObject.GetScript<PlayerController>().landedOnJumpPad = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
Name: SC_JumpPad
|
||||||
|
ID: 167326885
|
||||||
|
Type: 9
|
|
@ -0,0 +1,106 @@
|
||||||
|
using System;
|
||||||
|
using SHADE;
|
||||||
|
using SHADE_Scripting.Audio;
|
||||||
|
|
||||||
|
public class PauseMenu : Script
|
||||||
|
{
|
||||||
|
public GameObject resumeBtn;
|
||||||
|
public GameObject retryBtn;
|
||||||
|
public GameObject quitBtn;
|
||||||
|
|
||||||
|
public GameObject gamePauseText;
|
||||||
|
public GameObject canvas;
|
||||||
|
|
||||||
|
protected override void awake()
|
||||||
|
{
|
||||||
|
GameManager.Instance.GamePause = false;
|
||||||
|
if (gamePauseText)
|
||||||
|
gamePauseText.GetComponent<TextRenderable>().Enabled = false;
|
||||||
|
if (canvas)
|
||||||
|
canvas.SetActive(false);
|
||||||
|
|
||||||
|
if (!resumeBtn)
|
||||||
|
Debug.LogError("Resume Btn missing");
|
||||||
|
|
||||||
|
if (!retryBtn)
|
||||||
|
Debug.LogError("Retry Btn missing");
|
||||||
|
|
||||||
|
if (!quitBtn)
|
||||||
|
Debug.LogError("Quit Btn missing");
|
||||||
|
}
|
||||||
|
protected override void start()
|
||||||
|
{
|
||||||
|
//resume
|
||||||
|
UIElement resume = resumeBtn.GetComponent<UIElement>();
|
||||||
|
if (resume != null)
|
||||||
|
{
|
||||||
|
resume.OnClick.RegisterAction(() =>
|
||||||
|
{
|
||||||
|
if (GameManager.Instance.GamePause)
|
||||||
|
{
|
||||||
|
GameManager.Instance.GamePause = false;
|
||||||
|
AudioHandler.pauseAllSounds(false);
|
||||||
|
if (gamePauseText)
|
||||||
|
gamePauseText.GetComponent<TextRenderable>().Enabled = false;
|
||||||
|
if (canvas)
|
||||||
|
canvas.SetActive(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("Failed to register resume button.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//retry
|
||||||
|
UIElement retry = retryBtn.GetComponent<UIElement>();
|
||||||
|
if (retry != null)
|
||||||
|
{
|
||||||
|
retry.OnClick.RegisterAction(() =>
|
||||||
|
{
|
||||||
|
Audio.StopAllSounds();
|
||||||
|
//get curr scene
|
||||||
|
//SceneManager.ChangeScene();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("Failed to register retry button.");
|
||||||
|
}
|
||||||
|
|
||||||
|
UIElement quit = quitBtn.GetComponent<UIElement>();
|
||||||
|
if (quit != null)
|
||||||
|
{
|
||||||
|
quit.OnClick.RegisterAction(() =>
|
||||||
|
{
|
||||||
|
Audio.StopAllSounds();
|
||||||
|
//go to main menu
|
||||||
|
SceneManager.ChangeScene(97158628);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("Failed to register quit button.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void update()
|
||||||
|
{
|
||||||
|
if (GameManager.Instance.GamePause)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Input.GetKeyDown(Input.KeyCode.Escape) && !GameManager.Instance.GamePause)
|
||||||
|
{
|
||||||
|
GameManager.Instance.GamePause = true;
|
||||||
|
AudioHandler.pauseAllSounds(true);
|
||||||
|
if (gamePauseText)
|
||||||
|
gamePauseText.GetComponent<TextRenderable>().Enabled = true;
|
||||||
|
if (canvas)
|
||||||
|
canvas.SetActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Name: SC_PauseMenu
|
||||||
|
ID: 151952680
|
||||||
|
Type: 9
|
|
@ -296,7 +296,7 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
camera.offset = arm->GetOffset();
|
camera.offset = arm->GetOffset();
|
||||||
if (arm->lookAtCameraOrigin)
|
if (arm->lookAtCameraOrigin)
|
||||||
CameraLookAt(camera, camera.position);
|
CameraLookAt(camera, camera.position + arm->GetTargetOffset());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,4 +26,7 @@ constexpr SHEventIdentifier SH_GRAPHICS_LIGHT_ENABLE_SHADOW_EVENT { 17 };
|
||||||
constexpr SHEventIdentifier SH_BUTTON_CLICK_EVENT { 18 };
|
constexpr SHEventIdentifier SH_BUTTON_CLICK_EVENT { 18 };
|
||||||
constexpr SHEventIdentifier SH_PHYSICS_COLLIDER_DRAW_EVENT { 19 };
|
constexpr SHEventIdentifier SH_PHYSICS_COLLIDER_DRAW_EVENT { 19 };
|
||||||
constexpr SHEventIdentifier SH_WINDOW_RESIZE_EVENT { 20 };
|
constexpr SHEventIdentifier SH_WINDOW_RESIZE_EVENT { 20 };
|
||||||
|
constexpr SHEventIdentifier SH_BUTTON_RELEASE_EVENT { 21 };
|
||||||
|
constexpr SHEventIdentifier SH_BUTTON_HOVER_ENTER_EVENT { 22 };
|
||||||
|
constexpr SHEventIdentifier SH_BUTTON_HOVER_EXIT_EVENT { 23 };
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "Math/Transform/SHTransformComponent.h"
|
#include "Math/Transform/SHTransformComponent.h"
|
||||||
#include "Graphics/MiddleEnd/GlobalData/SHGlobalDescriptorSets.h"
|
#include "Graphics/MiddleEnd/GlobalData/SHGlobalDescriptorSets.h"
|
||||||
#include "Graphics/MiddleEnd/Interface/SHRenderer.h"
|
#include "Graphics/MiddleEnd/Interface/SHRenderer.h"
|
||||||
|
#include "Scene/SHSceneManager.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -184,6 +185,9 @@ namespace SHADE
|
||||||
|
|
||||||
for (auto& comp : textRendererComps)
|
for (auto& comp : textRendererComps)
|
||||||
{
|
{
|
||||||
|
if (!SHSceneManager::CheckNodeAndComponentsActive<SHTextRenderableComponent>(comp.GetEID()))
|
||||||
|
continue;
|
||||||
|
|
||||||
auto* transform = SHComponentManager::GetComponent<SHTransformComponent>(comp.GetEID());
|
auto* transform = SHComponentManager::GetComponent<SHTransformComponent>(comp.GetEID());
|
||||||
|
|
||||||
Handle<SHFont> fontHandle = comp.fontHandle;
|
Handle<SHFont> fontHandle = comp.fontHandle;
|
||||||
|
|
|
@ -70,6 +70,7 @@ namespace SHADE
|
||||||
//Compile component IDs
|
//Compile component IDs
|
||||||
const auto componentIDList = SHSerialization::GetComponentIDList(node[ComponentsNode]);
|
const auto componentIDList = SHSerialization::GetComponentIDList(node[ComponentsNode]);
|
||||||
eid = SHEntityManager::CreateEntity(componentIDList, eid, name, parentEID);
|
eid = SHEntityManager::CreateEntity(componentIDList, eid, name, parentEID);
|
||||||
|
|
||||||
createdEntities[oldEID] = eid;
|
createdEntities[oldEID] = eid;
|
||||||
//createdEntities.push_back(eid);
|
//createdEntities.push_back(eid);
|
||||||
if (node[NumberOfChildrenNode])
|
if (node[NumberOfChildrenNode])
|
||||||
|
@ -90,6 +91,12 @@ namespace SHADE
|
||||||
if (node[ScriptsNode])
|
if (node[ScriptsNode])
|
||||||
SHSystemManager::GetSystem<SHScriptEngine>()->DeserialiseScripts(eid, node[ScriptsNode]);
|
SHSystemManager::GetSystem<SHScriptEngine>()->DeserialiseScripts(eid, node[ScriptsNode]);
|
||||||
|
|
||||||
|
auto& sceneGraph = SHSceneManager::GetCurrentSceneGraph();
|
||||||
|
if (node[IsActiveNode])
|
||||||
|
{
|
||||||
|
sceneGraph.SetActive(eid, node[IsActiveNode].as<bool>());
|
||||||
|
}
|
||||||
|
|
||||||
return eid;
|
return eid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
SHButtonComponent::SHButtonComponent()
|
SHButtonComponent::SHButtonComponent()
|
||||||
:size(1.0f), isHovered(false), isClicked(false),
|
: defaultTexture(0), hoveredTexture(0), clickedTexture(0), currentTexture(0)
|
||||||
defaultTexture(0), hoveredTexture(0), clickedTexture(0), currentTexture(0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +40,9 @@ namespace SHADE
|
||||||
clickedTexture = texture;
|
clickedTexture = texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,6 @@ namespace SHADE
|
||||||
SHButtonComponent();
|
SHButtonComponent();
|
||||||
virtual ~SHButtonComponent() = default;
|
virtual ~SHButtonComponent() = default;
|
||||||
|
|
||||||
SHVec2 size;
|
|
||||||
|
|
||||||
AssetID GetClickedTexture() const noexcept;
|
AssetID GetClickedTexture() const noexcept;
|
||||||
AssetID GetDefaultTexture() const noexcept;
|
AssetID GetDefaultTexture() const noexcept;
|
||||||
AssetID GetHoveredTexture() const noexcept;
|
AssetID GetHoveredTexture() const noexcept;
|
||||||
|
@ -32,11 +30,7 @@ namespace SHADE
|
||||||
|
|
||||||
friend class SHUISystem;
|
friend class SHUISystem;
|
||||||
private:
|
private:
|
||||||
//Set to true when mouse is hovering over the button.
|
|
||||||
bool isHovered;
|
|
||||||
//This is set to true when the mouse clicks down, and set back to false when mouse releases.
|
|
||||||
//The event for the button click will be broadcasted when mouse release.
|
|
||||||
bool isClicked;
|
|
||||||
AssetID defaultTexture;
|
AssetID defaultTexture;
|
||||||
AssetID hoveredTexture;
|
AssetID hoveredTexture;
|
||||||
AssetID clickedTexture;
|
AssetID clickedTexture;
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
||||||
SHCanvasComponent::SHCanvasComponent()
|
SHCanvasComponent::SHCanvasComponent()
|
||||||
:width(1),height(1), dirtyMatrix(false), canvasMatrix()
|
:width(1), height(1), dirtyMatrix(false), canvasMatrix(), scaleByCanvasWidth(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,8 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SHCanvasComponent::CanvasSizeType SHCanvasComponent::GetCanvasWidth() const noexcept
|
SHCanvasComponent::CanvasSizeType SHCanvasComponent::GetCanvasWidth() const noexcept
|
||||||
{
|
{
|
||||||
return width;
|
return width;
|
||||||
|
@ -43,6 +45,8 @@ namespace SHADE
|
||||||
return canvasMatrix;
|
return canvasMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,6 +58,7 @@ RTTR_REGISTRATION
|
||||||
registration::class_<SHCanvasComponent>("Canvas Component")
|
registration::class_<SHCanvasComponent>("Canvas Component")
|
||||||
.property("Canvas Width", &SHCanvasComponent::GetCanvasWidth, &SHCanvasComponent::SetCanvasWidth)
|
.property("Canvas Width", &SHCanvasComponent::GetCanvasWidth, &SHCanvasComponent::SetCanvasWidth)
|
||||||
.property("Canvas Height", &SHCanvasComponent::GetCanvasHeight, &SHCanvasComponent::SetCanvasHeight)
|
.property("Canvas Height", &SHCanvasComponent::GetCanvasHeight, &SHCanvasComponent::SetCanvasHeight)
|
||||||
|
.property("Scale by canvas width", &SHCanvasComponent::scaleByCanvasWidth)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,15 +21,18 @@ namespace SHADE
|
||||||
|
|
||||||
SHCanvasComponent();
|
SHCanvasComponent();
|
||||||
~SHCanvasComponent() = default;
|
~SHCanvasComponent() = default;
|
||||||
|
bool scaleByCanvasWidth;
|
||||||
|
|
||||||
void SetCanvasSize(CanvasSizeType width, CanvasSizeType height) noexcept;
|
void SetCanvasSize(CanvasSizeType width, CanvasSizeType height) noexcept;
|
||||||
void SetCanvasWidth(CanvasSizeType width) noexcept;
|
void SetCanvasWidth(CanvasSizeType width) noexcept;
|
||||||
void SetCanvasHeight(CanvasSizeType height) noexcept;
|
void SetCanvasHeight(CanvasSizeType height) noexcept;
|
||||||
|
|
||||||
|
|
||||||
CanvasSizeType GetCanvasWidth() const noexcept;
|
CanvasSizeType GetCanvasWidth() const noexcept;
|
||||||
CanvasSizeType GetCanvasHeight() const noexcept;
|
CanvasSizeType GetCanvasHeight() const noexcept;
|
||||||
SHMatrix const& GetMatrix() const noexcept;
|
SHMatrix const& GetMatrix() const noexcept;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CanvasSizeType width;
|
CanvasSizeType width;
|
||||||
CanvasSizeType height;
|
CanvasSizeType height;
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
SHToggleButtonComponent::SHToggleButtonComponent()
|
SHToggleButtonComponent::SHToggleButtonComponent()
|
||||||
:size(1.0f), isHovered(false), isClicked(false), value(false),
|
:value(false), defaultTexture(0), toggledTexture(0), currentTexture(0)
|
||||||
defaultTexture(0), toggledTexture(0), currentTexture(0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,6 @@ namespace SHADE
|
||||||
SHToggleButtonComponent();
|
SHToggleButtonComponent();
|
||||||
virtual ~SHToggleButtonComponent() = default;
|
virtual ~SHToggleButtonComponent() = default;
|
||||||
|
|
||||||
SHVec2 size;
|
|
||||||
|
|
||||||
AssetID GetToggledTexture() const noexcept;
|
AssetID GetToggledTexture() const noexcept;
|
||||||
AssetID GetDefaultTexture() const noexcept;
|
AssetID GetDefaultTexture() const noexcept;
|
||||||
bool GetValue() const noexcept;
|
bool GetValue() const noexcept;
|
||||||
|
@ -33,11 +31,7 @@ namespace SHADE
|
||||||
friend class SHUISystem;
|
friend class SHUISystem;
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//Set to true when mouse is hovering over the button.
|
|
||||||
bool isHovered;
|
|
||||||
//This is set to true when the mouse clicks down, and set back to false when mouse releases.
|
|
||||||
//The event for the button click will be broadcasted when mouse release.
|
|
||||||
bool isClicked;
|
|
||||||
bool value;
|
bool value;
|
||||||
AssetID defaultTexture;
|
AssetID defaultTexture;
|
||||||
AssetID toggledTexture;
|
AssetID toggledTexture;
|
||||||
|
|
|
@ -7,6 +7,7 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
||||||
SHUIComponent::SHUIComponent()
|
SHUIComponent::SHUIComponent()
|
||||||
|
:size(1.0f), isHovered(false), isClicked(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,6 +28,20 @@ namespace SHADE
|
||||||
(void)id;
|
(void)id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SHUIComponent::GetIsHovered() const noexcept
|
||||||
|
{
|
||||||
|
return isHovered;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SHUIComponent::GetIsClicked() const noexcept
|
||||||
|
{
|
||||||
|
return isClicked;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SHUIComponent::SetEmptyHoveredClick(bool value) noexcept
|
||||||
|
{
|
||||||
|
(void)value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,6 +52,8 @@ RTTR_REGISTRATION
|
||||||
|
|
||||||
registration::class_<SHUIComponent>("UI Component")
|
registration::class_<SHUIComponent>("UI Component")
|
||||||
.property("Canvas ID", &SHUIComponent::GetCanvasID, &SHUIComponent::SetCanvasID)
|
.property("Canvas ID", &SHUIComponent::GetCanvasID, &SHUIComponent::SetCanvasID)
|
||||||
|
.property("Hovered", &SHUIComponent::GetIsHovered, &SHUIComponent::SetEmptyHoveredClick)
|
||||||
|
.property("Clicked", &SHUIComponent::GetIsClicked, &SHUIComponent::SetEmptyHoveredClick)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "SH_API.h"
|
#include "SH_API.h"
|
||||||
#include "ECS_Base/Components/SHComponent.h"
|
#include "ECS_Base/Components/SHComponent.h"
|
||||||
#include "Math/SHMatrix.h"
|
#include "Math/SHMatrix.h"
|
||||||
|
#include "Math/Vector/SHVec2.h"
|
||||||
|
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
@ -17,14 +18,29 @@ namespace SHADE
|
||||||
SHUIComponent();
|
SHUIComponent();
|
||||||
~SHUIComponent() = default;
|
~SHUIComponent() = default;
|
||||||
|
|
||||||
|
|
||||||
|
SHVec2 size;
|
||||||
|
|
||||||
|
|
||||||
SHMatrix const& GetMatrix() const noexcept;
|
SHMatrix const& GetMatrix() const noexcept;
|
||||||
EntityID GetCanvasID() const noexcept;
|
EntityID GetCanvasID() const noexcept;
|
||||||
void SetCanvasID(EntityID id) noexcept;
|
void SetCanvasID(EntityID id) noexcept;
|
||||||
|
|
||||||
|
bool GetIsHovered() const noexcept;
|
||||||
|
bool GetIsClicked() const noexcept;
|
||||||
|
|
||||||
|
void SetEmptyHoveredClick(bool value)noexcept;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SHMatrix localToCanvasMatrix;
|
SHMatrix localToCanvasMatrix;
|
||||||
EntityID canvasID;
|
EntityID canvasID;
|
||||||
|
|
||||||
|
//Set to true when mouse is hovering over the button. Only set if there is a Button/Slider/ToggleButton comp.
|
||||||
|
bool isHovered;
|
||||||
|
//This is set to true when the mouse clicks down, and set back to false when mouse releases. Only set if there is a Button/Slider/ToggleButton comp.
|
||||||
|
bool isClicked;
|
||||||
|
|
||||||
|
|
||||||
RTTR_ENABLE()
|
RTTR_ENABLE()
|
||||||
};
|
};
|
||||||
|
|
|
@ -131,8 +131,17 @@ namespace SHADE
|
||||||
auto cameraSystem = SHSystemManager::GetSystem<SHCameraSystem>();
|
auto cameraSystem = SHSystemManager::GetSystem<SHCameraSystem>();
|
||||||
SHVec2 camSize = cameraSystem->GetCameraWidthHeight(0);
|
SHVec2 camSize = cameraSystem->GetCameraWidthHeight(0);
|
||||||
comp.canvasMatrix = SHMatrix::Identity;
|
comp.canvasMatrix = SHMatrix::Identity;
|
||||||
comp.canvasMatrix(0, 0) = camSize.x * 0.5f / (comp.GetCanvasWidth() * 0.5f);
|
float scale = camSize.y / comp.GetCanvasHeight();
|
||||||
comp.canvasMatrix(1, 1) = camSize.y * 0.5f / (comp.GetCanvasHeight() * 0.5f);
|
if (comp.scaleByCanvasWidth)
|
||||||
|
{
|
||||||
|
scale = camSize.x / comp.GetCanvasWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
comp.canvasMatrix(0, 0) = scale;
|
||||||
|
comp.canvasMatrix(1, 1) = scale;
|
||||||
|
|
||||||
|
//comp.canvasMatrix(0, 0) = camSize.x * 0.5f / (comp.GetCanvasWidth() * 0.5f);
|
||||||
|
//comp.canvasMatrix(1, 1) = camSize.y * 0.5f / (comp.GetCanvasHeight() * 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHUISystem::UpdateCanvasMatrixRoutine::Execute(double dt) noexcept
|
void SHUISystem::UpdateCanvasMatrixRoutine::Execute(double dt) noexcept
|
||||||
|
@ -146,25 +155,15 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SHUISystem::CheckButtonHoveredOrClicked(SHUIComponent& comp) noexcept
|
||||||
void SHUISystem::UpdateButtonComponent(SHButtonComponent& comp) noexcept
|
|
||||||
{
|
{
|
||||||
if (!SHComponentManager::HasComponent<SHUIComponent>(comp.GetEID()))
|
SHVec4 topExtent4 = SHMatrix::Translate(-comp.size.x * 0.5f, comp.size.y * 0.5f, 0.0f) * comp.GetMatrix() * SHVec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
{
|
SHVec4 btmExtent4 = SHMatrix::Translate(comp.size.x * 0.5f, -comp.size.y * 0.5f, 0.0f) * comp.GetMatrix() * SHVec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
return;
|
|
||||||
}
|
|
||||||
auto cameraSystem = SHSystemManager::GetSystem<SHCameraSystem>();
|
|
||||||
auto uiComp = SHComponentManager::GetComponent<SHUIComponent>(comp.GetEID());
|
|
||||||
//auto canvasComp = SHComponentManager::GetComponent_s<SHCanvasComponent>(uiComp->canvasID);
|
|
||||||
|
|
||||||
SHVec4 topExtent4 = SHMatrix::Translate(-comp.size.x * 0.5f, comp.size.y * 0.5f, 0.0f) * uiComp->GetMatrix() * SHVec4(0.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
SHVec4 btmExtent4 = SHMatrix::Translate(comp.size.x * 0.5f, -comp.size.y * 0.5f, 0.0f) * uiComp->GetMatrix() * SHVec4(0.0f,0.0f, 0.0f,1.0f);
|
|
||||||
|
|
||||||
|
|
||||||
SHVec2 topExtent{ topExtent4.x,topExtent4.y };
|
SHVec2 topExtent{ topExtent4.x,topExtent4.y };
|
||||||
SHVec2 btmExtent{ btmExtent4.x,btmExtent4.y };
|
SHVec2 btmExtent{ btmExtent4.x,btmExtent4.y };
|
||||||
|
auto cameraSystem = SHSystemManager::GetSystem<SHCameraSystem>();
|
||||||
|
|
||||||
SHVec2 mousePos;
|
SHVec2 mousePos;
|
||||||
SHVec2 windowSize;
|
SHVec2 windowSize;
|
||||||
#ifdef SHEDITOR
|
#ifdef SHEDITOR
|
||||||
|
@ -188,11 +187,11 @@ namespace SHADE
|
||||||
mousePos /= windowSize;
|
mousePos /= windowSize;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SHVec2 camSize{ cameraSystem->GetCameraWidthHeight(0)};
|
SHVec2 camSize{ cameraSystem->GetCameraWidthHeight(0) };
|
||||||
//SHLOG_INFO("TopExtent: {}, {}", topExtent.x, topExtent.y)
|
//SHLOG_INFO("TopExtent: {}, {}", topExtent.x, topExtent.y)
|
||||||
|
|
||||||
topExtent = CanvasToScreenPoint(topExtent,true);
|
topExtent = CanvasToScreenPoint(topExtent, true);
|
||||||
btmExtent = CanvasToScreenPoint(btmExtent,true);
|
btmExtent = CanvasToScreenPoint(btmExtent, true);
|
||||||
//SHLOG_INFO("TopExtent: {}, {} Btm Extent: {}, {}", topExtent.x, topExtent.y, btmExtent.x, btmExtent.y)
|
//SHLOG_INFO("TopExtent: {}, {} Btm Extent: {}, {}", topExtent.x, topExtent.y, btmExtent.x, btmExtent.y)
|
||||||
|
|
||||||
|
|
||||||
|
@ -200,26 +199,48 @@ namespace SHADE
|
||||||
if (mousePos.x >= topExtent.x && mousePos.x <= btmExtent.x
|
if (mousePos.x >= topExtent.x && mousePos.x <= btmExtent.x
|
||||||
&& mousePos.y >= topExtent.y && mousePos.y <= btmExtent.y)
|
&& mousePos.y >= topExtent.y && mousePos.y <= btmExtent.y)
|
||||||
{
|
{
|
||||||
|
if (comp.isHovered == false)
|
||||||
|
{
|
||||||
|
SHButtonClickEvent clickEvent;
|
||||||
|
clickEvent.EID = comp.GetEID();
|
||||||
|
SHEventManager::BroadcastEvent(clickEvent, SH_BUTTON_HOVER_ENTER_EVENT);
|
||||||
|
}
|
||||||
comp.isHovered = true;
|
comp.isHovered = true;
|
||||||
#ifdef SHEDITOR
|
|
||||||
//if (SHSystemManager::GetSystem<SHEditor>()->editorState == SHEditor::State::PLAY)
|
|
||||||
{
|
|
||||||
if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::LMB))
|
#ifdef SHEDITOR
|
||||||
{
|
//if (SHSystemManager::GetSystem<SHEditor>()->editorState == SHEditor::State::PLAY)
|
||||||
comp.isClicked = true;
|
{
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::LMB))
|
if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::LMB))
|
||||||
{
|
{
|
||||||
comp.isClicked = true;
|
comp.isClicked = true;
|
||||||
|
SHButtonClickEvent clickEvent;
|
||||||
|
clickEvent.EID = comp.GetEID();
|
||||||
|
SHEventManager::BroadcastEvent(clickEvent, SH_BUTTON_CLICK_EVENT);
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
#else
|
||||||
|
if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::LMB))
|
||||||
|
{
|
||||||
|
comp.isClicked = true;
|
||||||
|
SHButtonClickEvent clickEvent;
|
||||||
|
clickEvent.EID = comp.GetEID();
|
||||||
|
SHEventManager::BroadcastEvent(clickEvent, SH_BUTTON_CLICK_EVENT);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//SHLOG_INFO("HOVERED")
|
//SHLOG_INFO("HOVERED")
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (comp.isHovered == true)
|
||||||
|
{
|
||||||
|
SHButtonClickEvent clickEvent;
|
||||||
|
clickEvent.EID = comp.GetEID();
|
||||||
|
SHEventManager::BroadcastEvent(clickEvent, SH_BUTTON_HOVER_EXIT_EVENT);
|
||||||
|
}
|
||||||
|
|
||||||
comp.isHovered = false;
|
comp.isHovered = false;
|
||||||
//SHLOG_INFO("NOT HOVERED")
|
//SHLOG_INFO("NOT HOVERED")
|
||||||
}
|
}
|
||||||
|
@ -228,9 +249,31 @@ namespace SHADE
|
||||||
comp.isClicked = false;
|
comp.isClicked = false;
|
||||||
SHButtonClickEvent clickEvent;
|
SHButtonClickEvent clickEvent;
|
||||||
clickEvent.EID = comp.GetEID();
|
clickEvent.EID = comp.GetEID();
|
||||||
SHEventManager::BroadcastEvent(clickEvent, SH_BUTTON_CLICK_EVENT);
|
SHEventManager::BroadcastEvent(clickEvent, SH_BUTTON_RELEASE_EVENT);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SHUISystem::UpdateButtonComponent(SHButtonComponent& comp) noexcept
|
||||||
|
{
|
||||||
|
if (!SHComponentManager::HasComponent<SHUIComponent>(comp.GetEID()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto cameraSystem = SHSystemManager::GetSystem<SHCameraSystem>();
|
||||||
|
auto uiComp = SHComponentManager::GetComponent<SHUIComponent>(comp.GetEID());
|
||||||
|
//auto canvasComp = SHComponentManager::GetComponent_s<SHCanvasComponent>(uiComp->canvasID);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CheckButtonHoveredOrClicked(*uiComp);
|
||||||
|
|
||||||
if (SHComponentManager::HasComponent<SHRenderable>(comp.GetEID()))
|
if (SHComponentManager::HasComponent<SHRenderable>(comp.GetEID()))
|
||||||
{
|
{
|
||||||
auto renderable = SHComponentManager::GetComponent_s<SHRenderable>(comp.GetEID());
|
auto renderable = SHComponentManager::GetComponent_s<SHRenderable>(comp.GetEID());
|
||||||
|
@ -238,7 +281,7 @@ namespace SHADE
|
||||||
|
|
||||||
|
|
||||||
AssetID textureID = 0;
|
AssetID textureID = 0;
|
||||||
if (!comp.isHovered && !comp.isClicked)
|
if (!uiComp->isHovered && !uiComp->isClicked)
|
||||||
{
|
{
|
||||||
if (comp.GetDefaultTexture() != 0 && SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE)
|
if (comp.GetDefaultTexture() != 0 && SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE)
|
||||||
{
|
{
|
||||||
|
@ -247,7 +290,7 @@ namespace SHADE
|
||||||
//SHLOG_INFO("SETTING DEFAULT TEXTURE")
|
//SHLOG_INFO("SETTING DEFAULT TEXTURE")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (comp.isClicked)
|
else if (uiComp->isClicked)
|
||||||
{
|
{
|
||||||
if (comp.GetClickedTexture() != 0 && SHAssetManager::GetType(comp.GetClickedTexture()) == AssetType::TEXTURE)
|
if (comp.GetClickedTexture() != 0 && SHAssetManager::GetType(comp.GetClickedTexture()) == AssetType::TEXTURE)
|
||||||
{
|
{
|
||||||
|
@ -288,80 +331,10 @@ namespace SHADE
|
||||||
auto uiComp = SHComponentManager::GetComponent<SHUIComponent>(comp.GetEID());
|
auto uiComp = SHComponentManager::GetComponent<SHUIComponent>(comp.GetEID());
|
||||||
//auto canvasComp = SHComponentManager::GetComponent_s<SHCanvasComponent>(uiComp->canvasID);
|
//auto canvasComp = SHComponentManager::GetComponent_s<SHCanvasComponent>(uiComp->canvasID);
|
||||||
|
|
||||||
SHVec4 topExtent4 = SHMatrix::Translate(-comp.size.x * 0.5f, comp.size.y * 0.5f, 0.0f) * uiComp->GetMatrix() * SHVec4(0.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
SHVec4 btmExtent4 = SHMatrix::Translate(comp.size.x * 0.5f, -comp.size.y * 0.5f, 0.0f) * uiComp->GetMatrix() * SHVec4(0.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
|
|
||||||
|
|
||||||
SHVec2 topExtent{ topExtent4.x,topExtent4.y };
|
if (CheckButtonHoveredOrClicked(*uiComp))
|
||||||
SHVec2 btmExtent{ btmExtent4.x,btmExtent4.y };
|
|
||||||
|
|
||||||
|
|
||||||
SHVec2 mousePos;
|
|
||||||
SHVec2 windowSize;
|
|
||||||
#ifdef SHEDITOR
|
|
||||||
windowSize = SHEditorWindowManager::GetEditorWindow<SHEditorViewport>()->beginContentRegionAvailable;
|
|
||||||
mousePos = SHEditorWindowManager::GetEditorWindow<SHEditorViewport>()->viewportMousePos;
|
|
||||||
//mousePos.y = windowSize.y - mousePos.y;
|
|
||||||
//SHLOG_INFO("mouse pos: {}, {}", mousePos.x, mousePos.y)
|
|
||||||
mousePos /= windowSize;
|
|
||||||
//SHLOG_INFO("mouse pos normalized: {}, {}", mousePos.x, mousePos.y)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
int x, y;
|
|
||||||
SHInputManager::GetMouseScreenPosition(&x, &y);
|
|
||||||
mousePos.x = x;
|
|
||||||
mousePos.y = y;
|
|
||||||
auto ws = SHSystemManager::GetSystem<SHGraphicsSystem>()->GetWindow()->GetWindowSize();
|
|
||||||
windowSize = { static_cast<float>(ws.first), static_cast<float>(ws.second) };
|
|
||||||
mousePos /= windowSize;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SHVec2 camSize{ cameraSystem->GetCameraWidthHeight(0) };
|
|
||||||
//SHLOG_INFO("TopExtent: {}, {}", topExtent.x, topExtent.y)
|
|
||||||
|
|
||||||
topExtent = CanvasToScreenPoint(topExtent, true);
|
|
||||||
btmExtent = CanvasToScreenPoint(btmExtent, true);
|
|
||||||
//SHLOG_INFO("TopExtent: {}, {} Btm Extent: {}, {}", topExtent.x, topExtent.y, btmExtent.x, btmExtent.y)
|
|
||||||
|
|
||||||
|
|
||||||
//comp.isClicked = false;
|
|
||||||
if (mousePos.x >= topExtent.x && mousePos.x <= btmExtent.x
|
|
||||||
&& mousePos.y >= topExtent.y && mousePos.y <= btmExtent.y)
|
|
||||||
{
|
|
||||||
comp.isHovered = true;
|
|
||||||
#ifdef SHEDITOR
|
|
||||||
//if (SHSystemManager::GetSystem<SHEditor>()->editorState == SHEditor::State::PLAY)
|
|
||||||
{
|
|
||||||
if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::LMB))
|
|
||||||
{
|
|
||||||
comp.isClicked = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::LMB))
|
|
||||||
{
|
|
||||||
comp.isClicked = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//SHLOG_INFO("HOVERED")
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
comp.isHovered = false;
|
|
||||||
//SHLOG_INFO("NOT HOVERED")
|
|
||||||
}
|
|
||||||
if (comp.isClicked && SHInputManager::GetKeyUp(SHInputManager::SH_KEYCODE::LMB))
|
|
||||||
{
|
|
||||||
comp.isClicked = false;
|
|
||||||
comp.value = !comp.value;
|
comp.value = !comp.value;
|
||||||
SHButtonClickEvent clickEvent;
|
|
||||||
clickEvent.EID = comp.GetEID();
|
|
||||||
SHEventManager::BroadcastEvent(clickEvent, SH_BUTTON_CLICK_EVENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SHComponentManager::HasComponent<SHRenderable>(comp.GetEID()))
|
if (SHComponentManager::HasComponent<SHRenderable>(comp.GetEID()))
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,6 +73,11 @@ namespace SHADE
|
||||||
void UpdateToggleButtonComponent(SHToggleButtonComponent& comp) noexcept;
|
void UpdateToggleButtonComponent(SHToggleButtonComponent& comp) noexcept;
|
||||||
void UpdateCanvasComponent(SHCanvasComponent& comp) noexcept;
|
void UpdateCanvasComponent(SHCanvasComponent& comp) noexcept;
|
||||||
|
|
||||||
|
//returns true on button release.
|
||||||
|
bool CheckButtonHoveredOrClicked(SHUIComponent& comp) noexcept;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SHVec2 CanvasToScreenPoint(SHVec2& const canvasPoint, bool normalized) noexcept;
|
SHVec2 CanvasToScreenPoint(SHVec2& const canvasPoint, bool normalized) noexcept;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,11 +47,16 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SHADE::Material Renderable::Material::get()
|
SHADE::Material Renderable::Material::get()
|
||||||
|
{
|
||||||
|
auto mat = GetNativeComponent()->GetModifiableMaterial();
|
||||||
|
return mat ? SHADE::Material(mat) : SHADE::Material();
|
||||||
|
}
|
||||||
|
SHADE::Material Renderable::SharedMaterial::get()
|
||||||
{
|
{
|
||||||
auto mat = GetNativeComponent()->GetMaterial();
|
auto mat = GetNativeComponent()->GetMaterial();
|
||||||
return mat ? SHADE::Material(mat) : SHADE::Material();
|
return mat ? SHADE::Material(mat) : SHADE::Material();
|
||||||
}
|
}
|
||||||
void Renderable::Material::set(SHADE::Material value)
|
void Renderable::SharedMaterial::set(SHADE::Material value)
|
||||||
{
|
{
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,9 +55,19 @@ namespace SHADE
|
||||||
void set(MeshAsset value);
|
void set(MeshAsset value);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Material used to render this Renderable.
|
/// Special instance of the shared Material for this Renderable. When accessing
|
||||||
|
/// this property, a new instance of the shared Material is created and assigned
|
||||||
|
/// to this Renderable. Hence, changes will only affect this Renderable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
property SHADE::Material Material
|
property SHADE::Material Material
|
||||||
|
{
|
||||||
|
SHADE::Material get();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// The shared Material used to render this Renderable and other Renderables
|
||||||
|
/// using the same base Material.
|
||||||
|
/// </summary>
|
||||||
|
property SHADE::Material SharedMaterial
|
||||||
{
|
{
|
||||||
SHADE::Material get();
|
SHADE::Material get();
|
||||||
void set(SHADE::Material value);
|
void set(SHADE::Material value);
|
||||||
|
|
Loading…
Reference in New Issue