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
threshHold: 2
ignoreRaccoon: true
print: true
- Type: Item
Enabled: true
Score: 100
@ -9223,6 +9224,7 @@
Enabled: true
threshHold: 1
ignoreRaccoon: true
print: false
- Type: Item
Enabled: true
Score: 10
@ -9493,10 +9495,14 @@
timer: 200
scoreText: 237
timeText: 206
multiplierText: 139
maxMultiplierDuration: 5
maxMultiplierCombo: 10
multiplierFont: 60
- EID: 199
Name: =====Text====
IsActive: true
NumberOfChildren: 2
NumberOfChildren: 3
Components: ~
Scripts: ~
- EID: 237
@ -9529,6 +9535,21 @@
Font: 176667660
IsActive: true
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
Name: ====Raccoon====
IsActive: true
@ -9724,6 +9745,7 @@
Enabled: true
threshHold: 0.100000001
ignoreRaccoon: false
print: false
- EID: 196
Name: Piece1
IsActive: true
@ -9933,6 +9955,7 @@
Enabled: true
threshHold: 0.100000001
ignoreRaccoon: false
print: false
- EID: 65703
Name: Piece1
IsActive: true
@ -10142,6 +10165,7 @@
Enabled: true
threshHold: 0.100000001
ignoreRaccoon: false
print: false
- EID: 65708
Name: Piece1
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;
public bool isBreak { get; set; }
private List<GameObject> itemPieces = new List<GameObject>();
private Random ran = new Random();
public bool print = false;
protected override void awake()
{
@ -44,7 +44,10 @@ public class Breakable : Script
if (ignoreRaccoon && info.GameObject.GetScript<PlayerController>())
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;
if(GameObject.GetScript<Item>())

View File

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

View File

@ -5,7 +5,7 @@ using System.Collections.Generic;
public class GameManager : Script
{
public enum GameState
{
{
START,
WIN,
LOSE
@ -26,6 +26,16 @@ public class GameManager : Script
public GameObject scoreText;
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; }
protected override void awake()
@ -40,12 +50,15 @@ public class GameManager : Script
totalItemCount = 0;
Score = 0;
currGameState = GameState.START;
itemScored = false;
currMultiplierCombo = 1;
currMultiplierDuration = 0;
fontScalar = new Vector3(multiplierFont / maxMultiplierDuration, multiplierFont / maxMultiplierDuration , multiplierFont / maxMultiplierDuration);
}
protected override void update()
{
Cheats();
if (currGameState == GameState.START)
{
timer -= Time.DeltaTimeF;
@ -54,6 +67,25 @@ public class GameManager : Script
if(timeText)
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))
{
currGameState = GameState.WIN;
@ -85,5 +117,15 @@ public class GameManager : Script
SceneManager.ChangeScene(97158628);
}
}
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>())
{
Audio.PlaySFXOnce2D("event:/Music/stingers/item_scored");
GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score;
GameManager.Instance.totalItemCount -= 1;
GameManager.Instance.ItemScored();
GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score * GameManager.Instance.currMultiplierCombo;
info.GameObject.SetActive(false);
}
}