Move GamePlayers to their own folders, and add coin berries to normal pause menu, and add attempts to custom mode
This commit is contained in:
18 files changed
+94
-55
No files matched your search
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 770cd0d0b059f463588d509083a1daf1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+19
-14
@@ -7,10 +7,11 @@ using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CustomGamePlayer : MonoBehaviour {
|
||||
public static CustomGamePlayer instance;
|
||||
public static CustomGamePlayer Instance;
|
||||
private readonly float spawnRate = 1f;
|
||||
private float nextSpawnTime;
|
||||
internal BigInteger score;
|
||||
private BigInteger attempts;
|
||||
private float boostLeft;
|
||||
private float slownessLeft;
|
||||
private float speedyLeft;
|
||||
@@ -45,6 +46,10 @@ public class CustomGamePlayer : MonoBehaviour {
|
||||
private float goldenBerryChance;
|
||||
private float nothingBerryChance;
|
||||
|
||||
void Awake() {
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
void Start() {
|
||||
CustomGameTempData customGameTempData = FindObjectsByType<CustomGameTempData>(FindObjectsSortMode.None)[0];
|
||||
if (customGameTempData == null) {
|
||||
@@ -123,14 +128,13 @@ public class CustomGamePlayer : MonoBehaviour {
|
||||
|
||||
lastMoveTime = Time.time;
|
||||
UnityEngine.InputSystem.EnhancedTouch.EnhancedTouchSupport.Enable();
|
||||
instance = this;
|
||||
|
||||
Cursor.visible = false;
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
backgroundMusic.volume = BazookaManager.Instance.GetSettingMusicVolume();
|
||||
screenWidth = Camera.main.orthographicSize * 2f * Camera.main.aspect;
|
||||
if (Application.isMobilePlatform) mobileButtons.SetActive(true);
|
||||
UpdateStats(0);
|
||||
UpdateStats(0, 1);
|
||||
}
|
||||
|
||||
void MoveBird() {
|
||||
@@ -528,7 +532,7 @@ public class CustomGamePlayer : MonoBehaviour {
|
||||
slownessLeft = 0f;
|
||||
speedyLeft = 0f;
|
||||
antiLeft = 0f;
|
||||
UpdateStats(0);
|
||||
UpdateStats(0, 1);
|
||||
|
||||
GameObject[] allberries = GameObject.FindGameObjectsWithTag("NormalBerry")
|
||||
.Concat(GameObject.FindGameObjectsWithTag("PoisonBerry"))
|
||||
@@ -545,9 +549,10 @@ public class CustomGamePlayer : MonoBehaviour {
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateStats(BigInteger scoreAddAmount) {
|
||||
void UpdateStats(BigInteger scoreAddAmount, BigInteger attemptAddAmount) {
|
||||
score += scoreAddAmount;
|
||||
scoreText.text = $"Score: {Tools.FormatWithCommas(score)}";
|
||||
attempts += attemptAddAmount;
|
||||
scoreText.text = $"Score: {Tools.FormatWithCommas(score)} \\u2022 Attempts: {Tools.FormatWithCommas(attempts)}";
|
||||
if (Application.isMobilePlatform) restartButton.interactable = score != 0;
|
||||
if (DiscordRPCHandler.Instance != null)
|
||||
DiscordRPCHandler.Instance.UpdateRPC("Playing in custom mode", "Score: " + Tools.FormatWithCommas(score));
|
||||
@@ -601,13 +606,13 @@ public class CustomGamePlayer : MonoBehaviour {
|
||||
void DoNormalBerry(GameObject berry) {
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Eat"), Camera.main.transform.position, 1.2f * BazookaManager.Instance.GetSettingSFXVolume());
|
||||
Destroy(berry);
|
||||
UpdateStats(1);
|
||||
UpdateStats(1, 0);
|
||||
}
|
||||
|
||||
void DoPoisonBerry() {
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Death"), Camera.main.transform.position, 1.2f * BazookaManager.Instance.GetSettingSFXVolume());
|
||||
Respawn();
|
||||
UpdateStats(0);
|
||||
UpdateStats(0, 0);
|
||||
}
|
||||
|
||||
void DoSlowBerry(GameObject berry) {
|
||||
@@ -619,7 +624,7 @@ public class CustomGamePlayer : MonoBehaviour {
|
||||
antiLeft = 0f;
|
||||
goldenLeft = 0f;
|
||||
if (score > 0) {
|
||||
UpdateStats(-1);
|
||||
UpdateStats(-1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -631,10 +636,10 @@ public class CustomGamePlayer : MonoBehaviour {
|
||||
goldenLeft = 0f;
|
||||
if (slownessLeft > 0f) {
|
||||
slownessLeft = 0f;
|
||||
UpdateStats(1);
|
||||
UpdateStats(1, 0);
|
||||
} else {
|
||||
boostLeft += 10f;
|
||||
UpdateStats(5);
|
||||
UpdateStats(5, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -646,7 +651,7 @@ public class CustomGamePlayer : MonoBehaviour {
|
||||
speedyLeft = 10f;
|
||||
antiLeft = 0f;
|
||||
goldenLeft = 0f;
|
||||
UpdateStats(10);
|
||||
UpdateStats(10, 0);
|
||||
}
|
||||
|
||||
void DoAntiBerry(GameObject berry) {
|
||||
@@ -657,7 +662,7 @@ public class CustomGamePlayer : MonoBehaviour {
|
||||
speedyLeft = 0f;
|
||||
antiLeft = 10f;
|
||||
goldenLeft = 0f;
|
||||
UpdateStats(0);
|
||||
UpdateStats(0, 0);
|
||||
}
|
||||
|
||||
void DoGoldenBerry(GameObject berry) {
|
||||
@@ -668,7 +673,7 @@ public class CustomGamePlayer : MonoBehaviour {
|
||||
speedyLeft = 0f;
|
||||
antiLeft = 0f;
|
||||
goldenLeft = 10f;
|
||||
UpdateStats(4);
|
||||
UpdateStats(4, 0);
|
||||
}
|
||||
|
||||
void DoNothingBerry(GameObject berry) {
|
||||
File renamed without changes.
+4
-6
@@ -6,7 +6,6 @@ public class CustomGamePlayerPauseMenu : MonoBehaviour {
|
||||
public static CustomGamePlayerPauseMenu Instance;
|
||||
[SerializeField] private Button backButton;
|
||||
[SerializeField] private Button continueButton;
|
||||
[SerializeField] private Button statsButton;
|
||||
[SerializeField] private Button editUiButton;
|
||||
[SerializeField] private Button resetUiButton;
|
||||
[SerializeField] private AudioSource songLoop;
|
||||
@@ -29,7 +28,7 @@ public class CustomGamePlayerPauseMenu : MonoBehaviour {
|
||||
|
||||
void Awake() {
|
||||
Instance = this;
|
||||
continueButton.onClick.AddListener(CustomGamePlayer.instance.DisablePause);
|
||||
continueButton.onClick.AddListener(CustomGamePlayer.Instance.DisablePause);
|
||||
musicSlider.onValueChanged.AddListener(value => {
|
||||
BazookaManager.Instance.SetSettingMusicVolume(value);
|
||||
songLoop.volume = value;
|
||||
@@ -83,7 +82,7 @@ public class CustomGamePlayerPauseMenu : MonoBehaviour {
|
||||
settingRandomMusicToggle.onValueChanged.AddListener(value => BazookaManager.Instance.SetSettingRandomMusic(value));
|
||||
musicSlider.onValueChanged.AddListener(value => {
|
||||
BazookaManager.Instance.SetSettingMusicVolume(value);
|
||||
CustomGamePlayer.instance.backgroundMusic.volume = value;
|
||||
CustomGamePlayer.Instance.backgroundMusic.volume = value;
|
||||
});
|
||||
sfxSlider.onValueChanged.AddListener(value => BazookaManager.Instance.SetSettingSFXVolume(value));
|
||||
}
|
||||
@@ -99,7 +98,6 @@ public class CustomGamePlayerPauseMenu : MonoBehaviour {
|
||||
settingRandomMusicToggle.gameObject.SetActive(!settingRandomMusicToggle.gameObject.activeSelf);
|
||||
backButton.gameObject.SetActive(!backButton.gameObject.activeSelf);
|
||||
continueButton.gameObject.SetActive(!continueButton.gameObject.activeSelf);
|
||||
statsButton.gameObject.SetActive(!statsButton.gameObject.activeSelf);
|
||||
editUiButton.transform.GetChild(0).GetComponent<TMP_Text>().text = editUiButton.transform.GetChild(0).GetComponent<TMP_Text>().text == "Edit UI" ? "Done" : "Edit UI";
|
||||
resetUiButton.gameObject.SetActive(!resetUiButton.gameObject.activeSelf);
|
||||
scoreText.GetComponent<DraggableUI>().canDrag = !scoreText.GetComponent<DraggableUI>().canDrag;
|
||||
@@ -121,8 +119,8 @@ public class CustomGamePlayerPauseMenu : MonoBehaviour {
|
||||
jumpButton.interactable = !jumpDraggableUI.canDrag;
|
||||
rightButton.interactable = !rightDraggableUI.canDrag;
|
||||
leftButton.interactable = !leftDraggableUI.canDrag;
|
||||
jumpButton.transform.GetChild(0).GetComponent<TMP_Text>().color = !jumpDraggableUI.canDrag ? CustomGamePlayer.instance.isGrounded ? Color.white : Color.red : Color.white;
|
||||
restartButton.interactable = CustomGamePlayer.instance.score != 0;
|
||||
jumpButton.transform.GetChild(0).GetComponent<TMP_Text>().color = !jumpDraggableUI.canDrag ? CustomGamePlayer.Instance.isGrounded ? Color.white : Color.red : Color.white;
|
||||
restartButton.interactable = CustomGamePlayer.Instance.score != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
@@ -7,7 +7,7 @@ using UnityEngine.InputSystem;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class GamePlayer : MonoBehaviour {
|
||||
public static GamePlayer instance;
|
||||
public static GamePlayer Instance;
|
||||
private readonly float spawnRate = 1f;
|
||||
private float nextSpawnTime;
|
||||
internal BigInteger score;
|
||||
@@ -51,6 +51,10 @@ public class GamePlayer : MonoBehaviour {
|
||||
[SerializeField] private Button rightButton;
|
||||
[SerializeField] private Button leftButton;
|
||||
|
||||
void Awake() {
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
void Start() {
|
||||
var backgroundColor = BazookaManager.Instance.GetColorSettingBackground();
|
||||
Camera.main.backgroundColor = new Color(
|
||||
@@ -113,7 +117,6 @@ public class GamePlayer : MonoBehaviour {
|
||||
|
||||
lastMoveTime = Time.time;
|
||||
UnityEngine.InputSystem.EnhancedTouch.EnhancedTouchSupport.Enable();
|
||||
instance = this;
|
||||
highscore = BazookaManager.Instance.GetGameStoreHighScore();
|
||||
totalNormalBerries = BazookaManager.Instance.GetGameStoreTotalNormalBerries();
|
||||
totalPoisonBerries = BazookaManager.Instance.GetGameStoreTotalPoisonBerries();
|
||||
File renamed without changes.
+5
-4
@@ -37,7 +37,7 @@ public class GamePlayerPauseMenu : MonoBehaviour {
|
||||
|
||||
void Awake() {
|
||||
Instance = this;
|
||||
continueButton.onClick.AddListener(GamePlayer.instance.DisablePause);
|
||||
continueButton.onClick.AddListener(GamePlayer.Instance.DisablePause);
|
||||
musicSlider.onValueChanged.AddListener(value => {
|
||||
BazookaManager.Instance.SetSettingMusicVolume(value);
|
||||
songLoop.volume = value;
|
||||
@@ -80,6 +80,7 @@ public class GamePlayerPauseMenu : MonoBehaviour {
|
||||
text.AppendLine("Total Poison Berries: " + Tools.FormatWithCommas(BazookaManager.Instance.GetGameStoreTotalPoisonBerries()));
|
||||
text.AppendLine("Total Slow Berries: " + Tools.FormatWithCommas(BazookaManager.Instance.GetGameStoreTotalSlowBerries()));
|
||||
text.AppendLine("Total Ultra Berries: " + Tools.FormatWithCommas(BazookaManager.Instance.GetGameStoreTotalUltraBerries()));
|
||||
text.AppendLine("Total Coin Berries: " + Tools.FormatWithCommas(BazookaManager.Instance.GetGameStoreTotalCoinBerries()));
|
||||
text.AppendLine("Total Speedy Berries: " + Tools.FormatWithCommas(BazookaManager.Instance.GetGameStoreTotalSpeedyBerries()));
|
||||
text.AppendLine("Total Random Berries: " + Tools.FormatWithCommas(BazookaManager.Instance.GetGameStoreTotalRandomBerries()));
|
||||
text.AppendLine("Total Anti Berries: " + Tools.FormatWithCommas(BazookaManager.Instance.GetGameStoreTotalAntiBerries()));
|
||||
@@ -116,7 +117,7 @@ public class GamePlayerPauseMenu : MonoBehaviour {
|
||||
settingRandomMusicToggle.onValueChanged.AddListener(value => BazookaManager.Instance.SetSettingRandomMusic(value));
|
||||
musicSlider.onValueChanged.AddListener(value => {
|
||||
BazookaManager.Instance.SetSettingMusicVolume(value);
|
||||
GamePlayer.instance.backgroundMusic.volume = value;
|
||||
GamePlayer.Instance.backgroundMusic.volume = value;
|
||||
});
|
||||
sfxSlider.onValueChanged.AddListener(value => BazookaManager.Instance.SetSettingSFXVolume(value));
|
||||
}
|
||||
@@ -157,8 +158,8 @@ public class GamePlayerPauseMenu : MonoBehaviour {
|
||||
jumpButton.interactable = !jumpDraggableUI.canDrag;
|
||||
rightButton.interactable = !rightDraggableUI.canDrag;
|
||||
leftButton.interactable = !leftDraggableUI.canDrag;
|
||||
jumpButton.transform.GetChild(0).GetComponent<TMP_Text>().color = !jumpDraggableUI.canDrag ? GamePlayer.instance.isGrounded ? Color.white : Color.red : Color.white;
|
||||
restartButton.interactable = GamePlayer.instance.score != 0;
|
||||
jumpButton.transform.GetChild(0).GetComponent<TMP_Text>().color = !jumpDraggableUI.canDrag ? GamePlayer.Instance.isGrounded ? Color.white : Color.red : Color.white;
|
||||
restartButton.interactable = GamePlayer.Instance.score != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,15 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class RainbowCamera : MonoBehaviour {
|
||||
public float frequency = 1f;
|
||||
[Range(0, 255)]
|
||||
public int brightness = 255;
|
||||
|
||||
void Update() {
|
||||
float t = Time.time * frequency;
|
||||
float r = (Mathf.Sin(t) * 0.5f + 0.5f) * (brightness / 255f);
|
||||
float g = (Mathf.Sin(t + 2f) * 0.5f + 0.5f) * (brightness / 255f);
|
||||
float b = (Mathf.Sin(t + 4f) * 0.5f + 0.5f) * (brightness / 255f);
|
||||
Camera.main.backgroundColor = new Color(r, g, b);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 978d421e3cbe74d80abe34cbf91014c5
|
||||
@@ -3,34 +3,34 @@ using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class SplashEntry {
|
||||
[Preserve]
|
||||
[JsonProperty("content")]
|
||||
public string Content { get; set; }
|
||||
[Preserve]
|
||||
[JsonProperty("content")]
|
||||
public string Content { get; set; }
|
||||
|
||||
[Preserve]
|
||||
[JsonProperty("attributes")]
|
||||
public SplashAttributes Attributes { get; set; } = new SplashAttributes();
|
||||
[Preserve]
|
||||
[JsonProperty("attributes")]
|
||||
public SplashAttributes Attributes { get; set; } = new SplashAttributes();
|
||||
}
|
||||
|
||||
[Preserve]
|
||||
public class SplashAttributes {
|
||||
[Preserve]
|
||||
[JsonProperty("flip")]
|
||||
public bool Flip { get; set; } = false;
|
||||
[Preserve]
|
||||
[JsonProperty("flip")]
|
||||
public bool Flip { get; set; } = false;
|
||||
|
||||
[Preserve]
|
||||
[JsonProperty("reverse")]
|
||||
public bool Reverse { get; set; } = false;
|
||||
[Preserve]
|
||||
[JsonProperty("reverse")]
|
||||
public bool Reverse { get; set; } = false;
|
||||
|
||||
[Preserve]
|
||||
[JsonProperty("bounceSpeed")]
|
||||
public int BounceSpeed { get; set; } = -1;
|
||||
[Preserve]
|
||||
[JsonProperty("bounceSpeed")]
|
||||
public int BounceSpeed { get; set; } = -1;
|
||||
|
||||
[Preserve]
|
||||
[JsonProperty("color")]
|
||||
public string Color { get; set; } = null;
|
||||
[Preserve]
|
||||
[JsonProperty("color")]
|
||||
public string Color { get; set; } = null;
|
||||
|
||||
[Preserve]
|
||||
[JsonProperty("rainbowSpeed")]
|
||||
public int RainbowSpeed { get; set; } = -1;
|
||||
[Preserve]
|
||||
[JsonProperty("rainbowSpeed")]
|
||||
public int RainbowSpeed { get; set; } = -1;
|
||||
}
|
||||
Reference in new issue
Block a user