added text to maingame
This commit is contained in:
parent
ee4e31f45f
commit
af93e59d0e
|
@ -8198,125 +8198,6 @@
|
|||
Strength: 0.699999988
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 2
|
||||
Name: Player
|
||||
IsActive: true
|
||||
NumberOfChildren: 3
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 2.12735963, y: 0.362327814, z: 6.98932981}
|
||||
Rotate: {x: -0, y: 0, z: -0}
|
||||
Scale: {x: 0.999999881, y: 1, z: 0.999999881}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 149697411
|
||||
Material: 126974645
|
||||
IsActive: true
|
||||
RigidBody Component:
|
||||
Type: Dynamic
|
||||
Drag: 1
|
||||
Angular Drag: 0.100000001
|
||||
Use Gravity: false
|
||||
Interpolate: true
|
||||
Sleeping Enabled: true
|
||||
Freeze Position X: false
|
||||
Freeze Position Y: true
|
||||
Freeze Position Z: false
|
||||
Freeze Rotation X: true
|
||||
Freeze Rotation Y: true
|
||||
Freeze Rotation Z: true
|
||||
IsActive: true
|
||||
Collider Component:
|
||||
Colliders:
|
||||
- Is Trigger: false
|
||||
Type: Box
|
||||
Half Extents: {x: 0.400000006, y: 0.5, z: 0.300000012}
|
||||
Friction: 0.400000006
|
||||
Bounciness: 0
|
||||
Density: 1
|
||||
Position Offset: {x: 0, y: 0.25, z: 0}
|
||||
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||
IsActive: true
|
||||
Scripts:
|
||||
- Type: PlayerController
|
||||
Enabled: true
|
||||
respawnPoint: 239
|
||||
currentState: 0
|
||||
maxMoveVel: 3
|
||||
moveForce: 50
|
||||
sprintMultiplier: 1.5
|
||||
rotationFactorPerFrame: 5
|
||||
maxJumpHeight: 1
|
||||
maxJumpTime: 0.5
|
||||
fallMultipler: 3
|
||||
lightMultiper: 0.75
|
||||
mediumMultiper: 0.5
|
||||
heavyMultiper: 0.25
|
||||
- Type: PickAndThrow
|
||||
Enabled: true
|
||||
throwForce: [300, 300, 300]
|
||||
delayTimer: 1
|
||||
aimingLength: 0.5
|
||||
- EID: 3
|
||||
Name: HoldingPoint
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: 0.699999988, z: 0.200000003}
|
||||
Rotate: {x: 0, y: 0, z: -0}
|
||||
Scale: {x: 1, y: 1, z: 1}
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 4
|
||||
Name: PlayerCamera
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: 0, z: 0}
|
||||
Rotate: {x: 0, y: 6.28318548, z: 2.23517329e-08}
|
||||
Scale: {x: 1, y: 1, z: 1}
|
||||
IsActive: true
|
||||
Camera Component:
|
||||
Position: {x: 2.12735963, y: 0.362327814, z: 7.98932981}
|
||||
Pitch: 0
|
||||
Yaw: 360
|
||||
Roll: 1.28065994e-06
|
||||
Width: 1920
|
||||
Height: 1080
|
||||
Near: 0.00999999978
|
||||
Far: 10000
|
||||
Perspective: true
|
||||
IsActive: true
|
||||
Camera Arm Component:
|
||||
Arm Pitch: 0
|
||||
Arm Yaw: 0
|
||||
Arm Length: 1
|
||||
Look At Camera Origin: true
|
||||
IsActive: true
|
||||
Scripts:
|
||||
- Type: SHADE_Scripting.ThirdPersonCamera
|
||||
Enabled: true
|
||||
armLength: 1
|
||||
turnSpeedPitch: 0.300000012
|
||||
turnSpeedYaw: 0.5
|
||||
pitchClamp: 45
|
||||
- EID: 9
|
||||
Name: PlayerBag
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: 0, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: -0}
|
||||
Scale: {x: 1, y: 1, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 144838771
|
||||
Material: 123745521
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 240
|
||||
Name: ====ItemPool====
|
||||
IsActive: true
|
||||
|
@ -8355,7 +8236,7 @@
|
|||
Colliders:
|
||||
- Is Trigger: false
|
||||
Type: Box
|
||||
Half Extents: {x: 0.100000001, y: 0.100000001, z: 0.100000001}
|
||||
Half Extents: {x: 0.200000003, y: 0.200000003, z: 0.200000003}
|
||||
Friction: 0.400000006
|
||||
Bounciness: 0
|
||||
Density: 1
|
||||
|
@ -8363,7 +8244,7 @@
|
|||
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||
- Is Trigger: true
|
||||
Type: Box
|
||||
Half Extents: {x: 0.300000012, y: 0.300000012, z: 0.300000012}
|
||||
Half Extents: {x: 0.400000006, y: 0.400000006, z: 0.400000006}
|
||||
Friction: 0.400000006
|
||||
Bounciness: 0
|
||||
Density: 1
|
||||
|
@ -8425,8 +8306,8 @@
|
|||
Scripts:
|
||||
- Type: Item
|
||||
Enabled: true
|
||||
Score: 10
|
||||
currCategory: 0
|
||||
Score: 100
|
||||
currCategory: 2
|
||||
- EID: 241
|
||||
Name: Mesh_Meat
|
||||
IsActive: true
|
||||
|
@ -8477,8 +8358,8 @@
|
|||
Scripts:
|
||||
- Type: Item
|
||||
Enabled: true
|
||||
Score: 10
|
||||
currCategory: 0
|
||||
Score: 50
|
||||
currCategory: 1
|
||||
- EID: 15
|
||||
Name: ====ScoreZonePool====
|
||||
IsActive: true
|
||||
|
@ -8561,6 +8442,185 @@
|
|||
Scripts:
|
||||
- Type: ScoringZone
|
||||
Enabled: true
|
||||
- EID: 238
|
||||
Name: ====GameManager====
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components: ~
|
||||
Scripts:
|
||||
- Type: GameManager
|
||||
Enabled: true
|
||||
itemPool: 240
|
||||
zonePool: 15
|
||||
winScene: 92009475
|
||||
loseScene: 91685359
|
||||
currGameState: 0
|
||||
totalItemCount: 0
|
||||
Score: 0
|
||||
timer: 100
|
||||
scoreText: 237
|
||||
timeText: 206
|
||||
- EID: 199
|
||||
Name: =====Text====
|
||||
IsActive: true
|
||||
NumberOfChildren: 2
|
||||
Components: ~
|
||||
Scripts: ~
|
||||
- EID: 237
|
||||
Name: Score
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -800, y: 400, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 60, y: 60, z: 60}
|
||||
IsActive: true
|
||||
Text Renderer Component:
|
||||
Text: My name is Brandon.
|
||||
Font: 176667660
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 206
|
||||
Name: Timer
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 500, y: 400, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 60, y: 60, z: 60}
|
||||
IsActive: true
|
||||
Text Renderer Component:
|
||||
Text: My name is Brandon.
|
||||
Font: 176667660
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 198
|
||||
Name: ====Raccoon====
|
||||
IsActive: true
|
||||
NumberOfChildren: 2
|
||||
Components: ~
|
||||
Scripts: ~
|
||||
- EID: 2
|
||||
Name: Player
|
||||
IsActive: true
|
||||
NumberOfChildren: 3
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 2.12735963, y: 0.362327814, z: 6.98932981}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 0.999999881, y: 1, z: 0.999999881}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 149697411
|
||||
Material: 126974645
|
||||
IsActive: true
|
||||
RigidBody Component:
|
||||
Type: Dynamic
|
||||
Drag: 1
|
||||
Angular Drag: 0.100000001
|
||||
Use Gravity: false
|
||||
Interpolate: true
|
||||
Sleeping Enabled: true
|
||||
Freeze Position X: false
|
||||
Freeze Position Y: true
|
||||
Freeze Position Z: false
|
||||
Freeze Rotation X: true
|
||||
Freeze Rotation Y: true
|
||||
Freeze Rotation Z: true
|
||||
IsActive: true
|
||||
Collider Component:
|
||||
Colliders:
|
||||
- Is Trigger: false
|
||||
Type: Box
|
||||
Half Extents: {x: 0.400000006, y: 0.5, z: 0.300000012}
|
||||
Friction: 0.400000006
|
||||
Bounciness: 0
|
||||
Density: 1
|
||||
Position Offset: {x: 0, y: 0.25, z: 0}
|
||||
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||
IsActive: true
|
||||
Scripts:
|
||||
- Type: PlayerController
|
||||
Enabled: true
|
||||
respawnPoint: 239
|
||||
currentState: 0
|
||||
maxMoveVel: 3
|
||||
moveForce: 50
|
||||
sprintMultiplier: 1.5
|
||||
rotationFactorPerFrame: 5
|
||||
maxJumpHeight: 1
|
||||
maxJumpTime: 0.5
|
||||
fallMultipler: 3
|
||||
lightMultiper: 0.75
|
||||
mediumMultiper: 0.5
|
||||
heavyMultiper: 0.25
|
||||
- Type: PickAndThrow
|
||||
Enabled: true
|
||||
throwForce: [50, 50, 50]
|
||||
delayTimer: 1
|
||||
aimingLength: 0.5
|
||||
- EID: 3
|
||||
Name: HoldingPoint
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: 0.700000048, z: 0.200000286}
|
||||
Rotate: {x: 0, y: 0, z: -0}
|
||||
Scale: {x: 1, y: 1, z: 1}
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 4
|
||||
Name: PlayerCamera
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: -2.98023224e-08, z: 4.76837158e-07}
|
||||
Rotate: {x: 0, y: 6.28318548, z: 2.23517329e-08}
|
||||
Scale: {x: 1, y: 1, z: 1}
|
||||
IsActive: true
|
||||
Camera Component:
|
||||
Position: {x: 2.12735963, y: 0.362327784, z: 7.98933029}
|
||||
Pitch: 0
|
||||
Yaw: 360
|
||||
Roll: 1.28065994e-06
|
||||
Width: 1920
|
||||
Height: 1080
|
||||
Near: 0.00999999978
|
||||
Far: 10000
|
||||
Perspective: true
|
||||
IsActive: true
|
||||
Camera Arm Component:
|
||||
Arm Pitch: 0
|
||||
Arm Yaw: 0
|
||||
Arm Length: 1
|
||||
Look At Camera Origin: true
|
||||
IsActive: true
|
||||
Scripts:
|
||||
- Type: SHADE_Scripting.ThirdPersonCamera
|
||||
Enabled: true
|
||||
armLength: 1
|
||||
turnSpeedPitch: 0.300000012
|
||||
turnSpeedYaw: 0.5
|
||||
pitchClamp: 45
|
||||
- EID: 9
|
||||
Name: PlayerBag
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: -2.98023224e-08, z: 4.76837158e-07}
|
||||
Rotate: {x: 0, y: 0, z: -0}
|
||||
Scale: {x: 1, y: 1, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 144838771
|
||||
Material: 123745521
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 239
|
||||
Name: RespawnPoint
|
||||
IsActive: true
|
||||
|
@ -8568,7 +8628,7 @@
|
|||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 2.5, y: 0.660660267, z: 7}
|
||||
Rotate: {x: -0, y: 0, z: -0}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 1, y: 1, z: 1}
|
||||
IsActive: true
|
||||
Scripts: ~
|
|
@ -2,6 +2,7 @@
|
|||
using SHADE_Scripting;
|
||||
using System;
|
||||
using static PlayerController;
|
||||
using static Item;
|
||||
|
||||
public class PickAndThrow : Script
|
||||
{
|
||||
|
@ -17,6 +18,7 @@ public class PickAndThrow : Script
|
|||
private RigidBody itemRidibody;
|
||||
private Transform raccoonHoldLocation;
|
||||
private Transform playerTran;
|
||||
private Item itemScript;
|
||||
private ThirdPersonCamera tpc;
|
||||
private float lastXDir;
|
||||
private float lastZDir;
|
||||
|
@ -59,7 +61,6 @@ public class PickAndThrow : Script
|
|||
|
||||
if (Input.GetMouseButtonDown(Input.MouseCode.LeftButton))
|
||||
{
|
||||
Debug.Log("AIMING");
|
||||
pc.isAiming = true;
|
||||
pc.camArm.ArmLength = aimingLength;
|
||||
}
|
||||
|
@ -73,19 +74,36 @@ public class PickAndThrow : Script
|
|||
pc.holdItem = false;
|
||||
inRange = false;
|
||||
itemRidibody.IsGravityEnabled = true;
|
||||
itemRidibody.AddForce(new Vector3(throwForce.x * lastXDir, throwForce.y, throwForce.z * lastZDir));
|
||||
if (itemScript)
|
||||
{
|
||||
Vector3 vec = new Vector3(throwForce.x * lastXDir, throwForce.y, throwForce.z * lastZDir);
|
||||
if (itemScript.currCategory == ItemCategory.LIGHT)
|
||||
itemRidibody.AddForce(vec * 0.3f);
|
||||
if (itemScript.currCategory == ItemCategory.MEDIUM)
|
||||
itemRidibody.AddForce(vec * 0.75f);
|
||||
if (itemScript.currCategory == ItemCategory.HEAVY)
|
||||
itemRidibody.AddForce(vec);
|
||||
}
|
||||
itemRidibody.LinearVelocity += pc.rb.LinearVelocity;
|
||||
ResetItemObject();
|
||||
timer = 0.0f;
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonDown(Input.MouseCode.RightButton))
|
||||
if (Input.GetMouseButtonDown(Input.MouseCode.RightButton) && !pc.isAiming)
|
||||
{
|
||||
pc.holdItem = false;
|
||||
inRange = false;
|
||||
itemRidibody.IsGravityEnabled = true;
|
||||
ResetItemObject();
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonDown(Input.MouseCode.RightButton) && pc.isAiming)
|
||||
{
|
||||
pc.isAiming = false;
|
||||
if (tpc)
|
||||
pc.camArm.ArmLength = tpc.armLength;
|
||||
}
|
||||
|
||||
}
|
||||
else if (!pc.holdItem)
|
||||
itemRidibody.IsGravityEnabled = true;
|
||||
|
@ -105,6 +123,7 @@ public class PickAndThrow : Script
|
|||
{
|
||||
itemRidibody = null;
|
||||
itemTransform = null;
|
||||
itemScript = null;
|
||||
item = new GameObject();
|
||||
}
|
||||
|
||||
|
@ -131,6 +150,10 @@ public class PickAndThrow : Script
|
|||
itemTransform.LocalEulerAngles = Vector3.Zero;
|
||||
}
|
||||
|
||||
itemScript = item.GetScript<Item>();
|
||||
if(!itemScript)
|
||||
Debug.Log("Item script EMPTY");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,20 +29,19 @@ public class GameManager : Script
|
|||
private IEnumerable<Item> listOfItems;
|
||||
private IEnumerable<ScoringZone> listOfZone;
|
||||
|
||||
public GameObject scoreText;
|
||||
public GameObject timeText;
|
||||
|
||||
private bool once = true;
|
||||
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
Audio.PlayBGMOnce2D("event:/Music/player_undetected");
|
||||
totalItemCount = 0;
|
||||
Score = 0;
|
||||
currGameState = GameState.START;
|
||||
|
||||
if (itemPool)
|
||||
{
|
||||
listOfItems = itemPool.GetScriptsInChildren<Item>();
|
||||
if (listOfItems != null)
|
||||
foreach (Item i in listOfItems)
|
||||
totalItemCount += 1;
|
||||
}
|
||||
|
||||
if (zonePool)
|
||||
{
|
||||
listOfZone = zonePool.GetScriptsInChildren<ScoringZone>();
|
||||
|
@ -54,19 +53,36 @@ public class GameManager : Script
|
|||
|
||||
protected override void update()
|
||||
{
|
||||
if (timer > 0 && currGameState == GameState.START)
|
||||
if (once)
|
||||
{
|
||||
if (itemPool)
|
||||
{
|
||||
listOfItems = itemPool.GetScriptsInChildren<Item>();
|
||||
if (listOfItems != null)
|
||||
foreach (Item i in listOfItems)
|
||||
totalItemCount += 1;
|
||||
}
|
||||
once = false;
|
||||
}
|
||||
|
||||
if (currGameState == GameState.START)
|
||||
{
|
||||
timer -= Time.DeltaTimeF;
|
||||
if (totalItemCount <= 0)
|
||||
if(scoreText)
|
||||
scoreText.GetComponent<TextRenderable>().Text = $"Score: {Score}";
|
||||
if(timeText)
|
||||
timeText.GetComponent<TextRenderable>().Text = $"Time Left: {timer.ToString("0.00")}";
|
||||
|
||||
if (timer > 0 && totalItemCount <= 0)
|
||||
{
|
||||
currGameState = GameState.WIN;
|
||||
SceneManager.ChangeScene(winScene);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
currGameState = GameState.LOSE;
|
||||
SceneManager.ChangeScene(loseScene);
|
||||
else if(timer < 0)
|
||||
{
|
||||
currGameState = GameState.LOSE;
|
||||
SceneManager.ChangeScene(loseScene);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ namespace YAML
|
|||
if (!gfxSystem)
|
||||
return false;
|
||||
|
||||
rhs.SetFont(SHResourceManager::LoadOrGet<SHFont>(node[TEXT_YAML_TAG.data()].as<AssetID>()));
|
||||
rhs.SetFont(SHResourceManager::LoadOrGet<SHFont>(node[FONT_YAML_TAG.data()].as<AssetID>()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue