added gameplay for level1 and multiplier combo is done

This commit is contained in:
Glence 2023-02-02 22:44:30 +08:00
parent 5b628baedf
commit 4af3440db7
8 changed files with 2282 additions and 132 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8937,6 +8937,7 @@
Enabled: true Enabled: true
threshHold: 2 threshHold: 2
ignoreRaccoon: true ignoreRaccoon: true
print: true
- Type: Item - Type: Item
Enabled: true Enabled: true
Score: 100 Score: 100
@ -9223,6 +9224,7 @@
Enabled: true Enabled: true
threshHold: 1 threshHold: 1
ignoreRaccoon: true ignoreRaccoon: true
print: false
- Type: Item - Type: Item
Enabled: true Enabled: true
Score: 10 Score: 10
@ -9493,10 +9495,14 @@
timer: 200 timer: 200
scoreText: 237 scoreText: 237
timeText: 206 timeText: 206
multiplierText: 139
maxMultiplierDuration: 5
maxMultiplierCombo: 10
multiplierFont: 60
- EID: 199 - EID: 199
Name: =====Text==== Name: =====Text====
IsActive: true IsActive: true
NumberOfChildren: 2 NumberOfChildren: 3
Components: ~ Components: ~
Scripts: ~ Scripts: ~
- EID: 237 - EID: 237
@ -9529,6 +9535,21 @@
Font: 176667660 Font: 176667660
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 139
Name: Multiplier
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -800, y: 300, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 60, y: 60, z: 60}
IsActive: true
Text Renderer Component:
Text: TEST
Font: 176667660
IsActive: true
Scripts: ~
- EID: 198 - EID: 198
Name: ====Raccoon==== Name: ====Raccoon====
IsActive: true IsActive: true
@ -9724,6 +9745,7 @@
Enabled: true Enabled: true
threshHold: 0.100000001 threshHold: 0.100000001
ignoreRaccoon: false ignoreRaccoon: false
print: false
- EID: 196 - EID: 196
Name: Piece1 Name: Piece1
IsActive: true IsActive: true
@ -9933,6 +9955,7 @@
Enabled: true Enabled: true
threshHold: 0.100000001 threshHold: 0.100000001
ignoreRaccoon: false ignoreRaccoon: false
print: false
- EID: 65703 - EID: 65703
Name: Piece1 Name: Piece1
IsActive: true IsActive: true
@ -10142,6 +10165,7 @@
Enabled: true Enabled: true
threshHold: 0.100000001 threshHold: 0.100000001
ignoreRaccoon: false ignoreRaccoon: false
print: false
- EID: 65708 - EID: 65708
Name: Piece1 Name: Piece1
IsActive: true IsActive: true

View File

@ -0,0 +1,19 @@
using System;
using SHADE;
public class FixRotation : Script
{
Transform tran;
protected override void awake()
{
tran = GetComponent<Transform>();
}
protected override void update()
{
if(tran)
tran.LocalEulerAngles = Vector3.Zero;
}
}

View File

@ -0,0 +1,3 @@
Name: FixRotation
ID: 162507316
Type: 9

View File

@ -12,7 +12,7 @@ public class Breakable : Script
private Transform trans; private Transform trans;
public bool isBreak { get; set; } public bool isBreak { get; set; }
private List<GameObject> itemPieces = new List<GameObject>(); private List<GameObject> itemPieces = new List<GameObject>();
private Random ran = new Random(); public bool print = false;
protected override void awake() protected override void awake()
{ {
@ -44,7 +44,10 @@ public class Breakable : Script
if (ignoreRaccoon && info.GameObject.GetScript<PlayerController>()) if (ignoreRaccoon && info.GameObject.GetScript<PlayerController>())
return; return;
if (rb.LinearVelocity.GetSqrMagnitude() > threshHold) if(print)
Debug.Log($"COLLIED {rb.LinearVelocity.GetSqrMagnitude()} with EiD: {info.GameObject.Name}");
if (rb.LinearVelocity.GetSqrMagnitude() > threshHold && !info.GameObject.GetScript<PlayerController>())
{ {
isBreak = true; isBreak = true;
if(GameObject.GetScript<Item>()) if(GameObject.GetScript<Item>())

View File

@ -371,7 +371,7 @@ public class PlayerController : Script
stateMachine.SetState(typeof(PlayerIdleState)); stateMachine.SetState(typeof(PlayerIdleState));
tranform.LocalPosition = respawnPoint.GetComponent<Transform>().LocalPosition; tranform.LocalPosition = respawnPoint.GetComponent<Transform>().LocalPosition;
if (pat && pat.item.GetScript<Item>()) if (pat && pat.item)
{ {
holdItem = false; holdItem = false;
isAiming = false; isAiming = false;

View File

@ -26,6 +26,16 @@ public class GameManager : Script
public GameObject scoreText; public GameObject scoreText;
public GameObject timeText; public GameObject timeText;
//mulitpler info
public GameObject multiplierText;
public float maxMultiplierDuration = 5.0f;
public float currMultiplierDuration { get; set; }
public int maxMultiplierCombo = 10;
public bool itemScored {get;set;}
public int currMultiplierCombo { get; set;}
public float multiplierFont = 60.0f;
private Vector3 fontScalar;
public static GameManager Instance { get; private set; } public static GameManager Instance { get; private set; }
protected override void awake() protected override void awake()
@ -40,12 +50,15 @@ public class GameManager : Script
totalItemCount = 0; totalItemCount = 0;
Score = 0; Score = 0;
currGameState = GameState.START; currGameState = GameState.START;
itemScored = false;
currMultiplierCombo = 1;
currMultiplierDuration = 0;
fontScalar = new Vector3(multiplierFont / maxMultiplierDuration, multiplierFont / maxMultiplierDuration , multiplierFont / maxMultiplierDuration);
} }
protected override void update() protected override void update()
{ {
Cheats(); Cheats();
if (currGameState == GameState.START) if (currGameState == GameState.START)
{ {
timer -= Time.DeltaTimeF; timer -= Time.DeltaTimeF;
@ -54,6 +67,25 @@ public class GameManager : Script
if(timeText) if(timeText)
timeText.GetComponent<TextRenderable>().Text = $"Time Left: {timer.ToString("0.00")}"; timeText.GetComponent<TextRenderable>().Text = $"Time Left: {timer.ToString("0.00")}";
if (itemScored)
{
multiplierText.GetComponent<TextRenderable>().Text = $"X {currMultiplierCombo}";
multiplierText.GetComponent<Transform>().LocalScale -= fontScalar * Time.DeltaTimeF;
currMultiplierDuration += Time.DeltaTimeF;
if (currMultiplierDuration >= maxMultiplierDuration)
{
itemScored = false;
currMultiplierCombo = 1;
currMultiplierDuration = 0;
}
}
else
{
multiplierText.GetComponent<Transform>().LocalScale = Vector3.Zero;
}
if ((timer > 0 && totalItemCount < 0) || Input.GetKeyDown(Input.KeyCode.F1)) if ((timer > 0 && totalItemCount < 0) || Input.GetKeyDown(Input.KeyCode.F1))
{ {
currGameState = GameState.WIN; currGameState = GameState.WIN;
@ -86,4 +118,14 @@ public class GameManager : Script
} }
} }
public void ItemScored()
{
totalItemCount -= 1;
itemScored = true;
currMultiplierDuration = 0;
multiplierText.GetComponent<Transform>().LocalScale = new Vector3(multiplierFont, multiplierFont, multiplierFont);
if (currMultiplierCombo < maxMultiplierCombo)
currMultiplierCombo += 1;
}
} }

View File

@ -12,8 +12,8 @@ public class ScoringZone : Script
if (GameManager.Instance && info.GameObject.GetScript<Item>()) if (GameManager.Instance && info.GameObject.GetScript<Item>())
{ {
Audio.PlaySFXOnce2D("event:/Music/stingers/item_scored"); Audio.PlaySFXOnce2D("event:/Music/stingers/item_scored");
GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score; GameManager.Instance.ItemScored();
GameManager.Instance.totalItemCount -= 1; GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score * GameManager.Instance.currMultiplierCombo;
info.GameObject.SetActive(false); info.GameObject.SetActive(false);
} }
} }