Switch to BigInteger for scores
This commit is contained in:
@@ -5,6 +5,7 @@ using UnityEngine;
|
|||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
using System.Numerics;
|
||||||
|
|
||||||
public class AccountMenu : MonoBehaviour
|
public class AccountMenu : MonoBehaviour
|
||||||
{
|
{
|
||||||
@@ -107,7 +108,7 @@ public class AccountMenu : MonoBehaviour
|
|||||||
PlayerPrefs.DeleteKey("gameSession");
|
PlayerPrefs.DeleteKey("gameSession");
|
||||||
PlayerPrefs.DeleteKey("userName");
|
PlayerPrefs.DeleteKey("userName");
|
||||||
PlayerPrefs.DeleteKey("userId");
|
PlayerPrefs.DeleteKey("userId");
|
||||||
PlayerPrefs.SetInt("HighScore", 0);
|
PlayerPrefs.SetString("HighScoreV2", "0");
|
||||||
PlayerPrefs.SetInt("icon", 1);
|
PlayerPrefs.SetInt("icon", 1);
|
||||||
PlayerPrefs.SetInt("overlay", 0);
|
PlayerPrefs.SetInt("overlay", 0);
|
||||||
loggedInPanel.SetActive(false);
|
loggedInPanel.SetActive(false);
|
||||||
@@ -240,7 +241,7 @@ public class AccountMenu : MonoBehaviour
|
|||||||
WWWForm dataForm = new();
|
WWWForm dataForm = new();
|
||||||
dataForm.AddField("username", loginUsernameInput.text);
|
dataForm.AddField("username", loginUsernameInput.text);
|
||||||
dataForm.AddField("password", loginPasswordInput.text);
|
dataForm.AddField("password", loginPasswordInput.text);
|
||||||
dataForm.AddField("currentHighScore", PlayerPrefs.GetInt("HighScore", 0).ToString());
|
dataForm.AddField("currentHighScore", PlayerPrefs.GetString("HighScoreV2", "0"));
|
||||||
using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/loginAccount.php", dataForm);
|
using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/loginAccount.php", dataForm);
|
||||||
request.SetRequestHeader("User-Agent", "BerryDashClient");
|
request.SetRequestHeader("User-Agent", "BerryDashClient");
|
||||||
request.SetRequestHeader("ClientVersion", Application.version);
|
request.SetRequestHeader("ClientVersion", Application.version);
|
||||||
@@ -264,13 +265,13 @@ public class AccountMenu : MonoBehaviour
|
|||||||
string session = array[1];
|
string session = array[1];
|
||||||
string userName = array[2];
|
string userName = array[2];
|
||||||
int userId = int.Parse(array[3]);
|
int userId = int.Parse(array[3]);
|
||||||
int highScore = int.Parse(array[4]);
|
BigInteger highScore = BigInteger.Parse(array[4]);
|
||||||
int iconId = int.Parse(array[5]);
|
int iconId = int.Parse(array[5]);
|
||||||
int overlayId = int.Parse(array[6]);
|
int overlayId = int.Parse(array[6]);
|
||||||
PlayerPrefs.SetString("gameSession", session);
|
PlayerPrefs.SetString("gameSession", session);
|
||||||
PlayerPrefs.SetString("userName", userName);
|
PlayerPrefs.SetString("userName", userName);
|
||||||
PlayerPrefs.SetInt("userId", userId);
|
PlayerPrefs.SetInt("userId", userId);
|
||||||
PlayerPrefs.SetInt("HighScore", highScore);
|
PlayerPrefs.SetString("HighScoreV2", highScore.ToString());
|
||||||
PlayerPrefs.SetInt("icon", iconId);
|
PlayerPrefs.SetInt("icon", iconId);
|
||||||
PlayerPrefs.SetInt("overlay", overlayId);
|
PlayerPrefs.SetInt("overlay", overlayId);
|
||||||
SwitchPanel(0);
|
SwitchPanel(0);
|
||||||
@@ -396,7 +397,7 @@ public class AccountMenu : MonoBehaviour
|
|||||||
WWWForm dataForm = new();
|
WWWForm dataForm = new();
|
||||||
dataForm.AddField("userName", PlayerPrefs.GetString("userName", ""));
|
dataForm.AddField("userName", PlayerPrefs.GetString("userName", ""));
|
||||||
dataForm.AddField("gameSession", PlayerPrefs.GetString("gameSession", ""));
|
dataForm.AddField("gameSession", PlayerPrefs.GetString("gameSession", ""));
|
||||||
dataForm.AddField("highScore", PlayerPrefs.GetInt("HighScore", 0).ToString());
|
dataForm.AddField("highScore", PlayerPrefs.GetString("HighScoreV2", "0"));
|
||||||
dataForm.AddField("icon", PlayerPrefs.GetInt("icon", 1).ToString());
|
dataForm.AddField("icon", PlayerPrefs.GetInt("icon", 1).ToString());
|
||||||
dataForm.AddField("overlay", PlayerPrefs.GetInt("overlay", 0).ToString());
|
dataForm.AddField("overlay", PlayerPrefs.GetInt("overlay", 0).ToString());
|
||||||
using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/saveAccount.php", dataForm);
|
using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/saveAccount.php", dataForm);
|
||||||
@@ -459,7 +460,7 @@ public class AccountMenu : MonoBehaviour
|
|||||||
var split = response.Split(":");
|
var split = response.Split(":");
|
||||||
if (split[0] == "1")
|
if (split[0] == "1")
|
||||||
{
|
{
|
||||||
PlayerPrefs.SetInt("HighScore", int.Parse(split[1]));
|
PlayerPrefs.SetString("HighScoreV2", split[1]);
|
||||||
PlayerPrefs.SetInt("icon", int.Parse(split[2]));
|
PlayerPrefs.SetInt("icon", int.Parse(split[2]));
|
||||||
PlayerPrefs.SetInt("overlay", int.Parse(split[3]));
|
PlayerPrefs.SetInt("overlay", int.Parse(split[3]));
|
||||||
UpdateStatusText(loggedInText, "Loaded account data", Color.green);
|
UpdateStatusText(loggedInText, "Loaded account data", Color.green);
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
using TMPro;
|
using System.Numerics;
|
||||||
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class GamePlayer : MonoBehaviour
|
public class GamePlayer : MonoBehaviour
|
||||||
{
|
{
|
||||||
private readonly float spawnRate = 1f;
|
private readonly float spawnRate = 1f;
|
||||||
private float nextSpawnTime;
|
private float nextSpawnTime;
|
||||||
private int score;
|
private BigInteger score;
|
||||||
private int highscore;
|
private BigInteger highscore;
|
||||||
private float boostLeft;
|
private float boostLeft;
|
||||||
private float slownessLeft;
|
private float slownessLeft;
|
||||||
private float screenWidth;
|
private float screenWidth;
|
||||||
@@ -25,7 +26,7 @@ public class GamePlayer : MonoBehaviour
|
|||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
highscore = PlayerPrefs.GetInt("HighScore", 0);
|
highscore = BigInteger.Parse(PlayerPrefs.GetString("HighScoreV2", "0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
@@ -46,7 +47,7 @@ public class GamePlayer : MonoBehaviour
|
|||||||
if (num2 == 8)
|
if (num2 == 8)
|
||||||
{
|
{
|
||||||
overlayRender.sprite = Resources.Load<Sprite>("Icons/Overlays/overlay_8");
|
overlayRender.sprite = Resources.Load<Sprite>("Icons/Overlays/overlay_8");
|
||||||
overlayRender.transform.localPosition = new Vector3(-0.37f, 0.32f, 0f);
|
overlayRender.transform.localPosition = new UnityEngine.Vector3(-0.37f, 0.32f, 0f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -85,30 +86,30 @@ public class GamePlayer : MonoBehaviour
|
|||||||
restartButton.GetComponent<SpriteRenderer>().sprite = Resources.Load<Sprite>("Arrows/Restart");
|
restartButton.GetComponent<SpriteRenderer>().sprite = Resources.Load<Sprite>("Arrows/Restart");
|
||||||
backButton.GetComponent<SpriteRenderer>().sprite = Resources.Load<Sprite>("Arrows/Back");
|
backButton.GetComponent<SpriteRenderer>().sprite = Resources.Load<Sprite>("Arrows/Back");
|
||||||
|
|
||||||
leftArrow.transform.rotation = Quaternion.Euler(0f, 0f, 90f);
|
leftArrow.transform.rotation = UnityEngine.Quaternion.Euler(0f, 0f, 90f);
|
||||||
rightArrow.transform.rotation = Quaternion.Euler(0f, 0f, -90f);
|
rightArrow.transform.rotation = UnityEngine.Quaternion.Euler(0f, 0f, -90f);
|
||||||
|
|
||||||
leftArrow.transform.position = new Vector3(-screenWidth / 2.5f, -4f, 0f);
|
leftArrow.transform.position = new UnityEngine.Vector3(-screenWidth / 2.5f, -4f, 0f);
|
||||||
rightArrow.transform.position = new Vector3(screenWidth / 2.5f, -4f, 0f);
|
rightArrow.transform.position = new UnityEngine.Vector3(screenWidth / 2.5f, -4f, 0f);
|
||||||
restartButton.transform.position = new Vector3(screenWidth / 2.3f, Camera.main.orthographicSize - 1.2f, 0f);
|
restartButton.transform.position = new UnityEngine.Vector3(screenWidth / 2.3f, Camera.main.orthographicSize - 1.2f, 0f);
|
||||||
backButton.transform.position = new Vector3(-screenWidth / 2.3f, Camera.main.orthographicSize - 1.2f, 0f);
|
backButton.transform.position = new UnityEngine.Vector3(-screenWidth / 2.3f, Camera.main.orthographicSize - 1.2f, 0f);
|
||||||
if (PlayerPrefs.GetInt("Setting3", 0) == 1)
|
if (PlayerPrefs.GetInt("Setting3", 0) == 1)
|
||||||
{
|
{
|
||||||
leftArrow.transform.localScale = new Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
leftArrow.transform.localScale = new UnityEngine.Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
||||||
rightArrow.transform.localScale = new Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
rightArrow.transform.localScale = new UnityEngine.Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
||||||
jumpArrow.transform.localScale = new Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
jumpArrow.transform.localScale = new UnityEngine.Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
||||||
restartButton.transform.localScale = new Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
restartButton.transform.localScale = new UnityEngine.Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
||||||
backButton.transform.localScale = new Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
backButton.transform.localScale = new UnityEngine.Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
||||||
jumpArrow.transform.position = new Vector3(screenWidth / 2.5f, -1f, 0f);
|
jumpArrow.transform.position = new UnityEngine.Vector3(screenWidth / 2.5f, -1f, 0f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
leftArrow.transform.localScale = new Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
leftArrow.transform.localScale = new UnityEngine.Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
||||||
rightArrow.transform.localScale = new Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
rightArrow.transform.localScale = new UnityEngine.Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
||||||
jumpArrow.transform.localScale = new Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
jumpArrow.transform.localScale = new UnityEngine.Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
||||||
restartButton.transform.localScale = new Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
restartButton.transform.localScale = new UnityEngine.Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
||||||
backButton.transform.localScale = new Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
backButton.transform.localScale = new UnityEngine.Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
||||||
jumpArrow.transform.position = new Vector3(screenWidth / 2.5f, -2f, 0f);
|
jumpArrow.transform.position = new UnityEngine.Vector3(screenWidth / 2.5f, -2f, 0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,7 +164,7 @@ public class GamePlayer : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (Input.GetMouseButton(0))
|
if (Input.GetMouseButton(0))
|
||||||
{
|
{
|
||||||
Vector3 touchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
UnityEngine.Vector3 touchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||||
touchPosition.z = 0f;
|
touchPosition.z = 0f;
|
||||||
if (leftArrow.GetComponent<SpriteRenderer>().bounds.Contains(touchPosition))
|
if (leftArrow.GetComponent<SpriteRenderer>().bounds.Contains(touchPosition))
|
||||||
{
|
{
|
||||||
@@ -180,7 +181,7 @@ public class GamePlayer : MonoBehaviour
|
|||||||
}
|
}
|
||||||
if (Input.GetMouseButtonDown(0))
|
if (Input.GetMouseButtonDown(0))
|
||||||
{
|
{
|
||||||
Vector3 point2 = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
UnityEngine.Vector3 point2 = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||||
point2.z = 0f;
|
point2.z = 0f;
|
||||||
if (restartButton.GetComponent<SpriteRenderer>().bounds.Contains(point2))
|
if (restartButton.GetComponent<SpriteRenderer>().bounds.Contains(point2))
|
||||||
{
|
{
|
||||||
@@ -197,7 +198,7 @@ public class GamePlayer : MonoBehaviour
|
|||||||
for (int i = 0; i < Input.touchCount; i++)
|
for (int i = 0; i < Input.touchCount; i++)
|
||||||
{
|
{
|
||||||
Touch touchPosition = Input.GetTouch(i);
|
Touch touchPosition = Input.GetTouch(i);
|
||||||
Vector3 clickPosition = Camera.main.ScreenToWorldPoint(touchPosition.position);
|
UnityEngine.Vector3 clickPosition = Camera.main.ScreenToWorldPoint(touchPosition.position);
|
||||||
clickPosition.z = 0f;
|
clickPosition.z = 0f;
|
||||||
if (leftArrow.GetComponent<SpriteRenderer>().bounds.Contains(clickPosition))
|
if (leftArrow.GetComponent<SpriteRenderer>().bounds.Contains(clickPosition))
|
||||||
{
|
{
|
||||||
@@ -224,30 +225,30 @@ public class GamePlayer : MonoBehaviour
|
|||||||
}
|
}
|
||||||
if (doMoveLeft && !doMoveRight)
|
if (doMoveLeft && !doMoveRight)
|
||||||
{
|
{
|
||||||
bird.transform.position += new Vector3(-movespeed, 0f, 0f);
|
bird.transform.position += new UnityEngine.Vector3(-movespeed, 0f, 0f);
|
||||||
ClampPosition(screenWidth, bird);
|
ClampPosition(screenWidth, bird);
|
||||||
bird.transform.localScale = new Vector3(1.35f, 1.35f, 1.35f);
|
bird.transform.localScale = new UnityEngine.Vector3(1.35f, 1.35f, 1.35f);
|
||||||
}
|
}
|
||||||
if (doMoveRight && !doMoveLeft)
|
if (doMoveRight && !doMoveLeft)
|
||||||
{
|
{
|
||||||
bird.transform.position += new Vector3(movespeed, 0f, 0f);
|
bird.transform.position += new UnityEngine.Vector3(movespeed, 0f, 0f);
|
||||||
ClampPosition(screenWidth, bird);
|
ClampPosition(screenWidth, bird);
|
||||||
bird.transform.localScale = new Vector3(-1.35f, 1.35f, 1.35f);
|
bird.transform.localScale = new UnityEngine.Vector3(-1.35f, 1.35f, 1.35f);
|
||||||
}
|
}
|
||||||
if (doJump && isGrounded)
|
if (doJump && isGrounded)
|
||||||
{
|
{
|
||||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Jump"), Camera.main.transform.position, 0.75f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Jump"), Camera.main.transform.position, 0.75f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
||||||
if (boostLeft > 0f)
|
if (boostLeft > 0f)
|
||||||
{
|
{
|
||||||
rb.linearVelocity = Vector2.up * 12f;
|
rb.linearVelocity = UnityEngine.Vector2.up * 12f;
|
||||||
}
|
}
|
||||||
else if (slownessLeft > 0f)
|
else if (slownessLeft > 0f)
|
||||||
{
|
{
|
||||||
rb.linearVelocity = Vector2.up * 6f;
|
rb.linearVelocity = UnityEngine.Vector2.up * 6f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rb.linearVelocity = Vector2.up * 9f;
|
rb.linearVelocity = UnityEngine.Vector2.up * 9f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flag4)
|
if (flag4)
|
||||||
@@ -264,7 +265,7 @@ public class GamePlayer : MonoBehaviour
|
|||||||
{
|
{
|
||||||
float halfWidth = screenWidth / 2.17f;
|
float halfWidth = screenWidth / 2.17f;
|
||||||
float clampedX = Mathf.Clamp(bird.transform.position.x, -halfWidth, halfWidth);
|
float clampedX = Mathf.Clamp(bird.transform.position.x, -halfWidth, halfWidth);
|
||||||
bird.transform.position = new Vector3(clampedX, bird.transform.position.y, bird.transform.position.z);
|
bird.transform.position = new UnityEngine.Vector3(clampedX, bird.transform.position.y, bird.transform.position.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FixedUpdate()
|
void FixedUpdate()
|
||||||
@@ -334,11 +335,11 @@ public class GamePlayer : MonoBehaviour
|
|||||||
|
|
||||||
float screenWidth = Camera.main.orthographicSize * 2 * Camera.main.aspect;
|
float screenWidth = Camera.main.orthographicSize * 2 * Camera.main.aspect;
|
||||||
float spawnPositionX = Random.Range(-screenWidth / 2.17f, screenWidth / 2.17f);
|
float spawnPositionX = Random.Range(-screenWidth / 2.17f, screenWidth / 2.17f);
|
||||||
newBerry.transform.position = new Vector3(spawnPositionX, Camera.main.orthographicSize + 1f, 0f);
|
newBerry.transform.position = new UnityEngine.Vector3(spawnPositionX, Camera.main.orthographicSize + 1f, 0f);
|
||||||
|
|
||||||
Rigidbody2D rb = newBerry.AddComponent<Rigidbody2D>();
|
Rigidbody2D rb = newBerry.AddComponent<Rigidbody2D>();
|
||||||
rb.gravityScale = 0f;
|
rb.gravityScale = 0f;
|
||||||
rb.linearVelocity = new Vector2(0f, -4f);
|
rb.linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,27 +362,27 @@ public class GamePlayer : MonoBehaviour
|
|||||||
GameObject jumpArrow = GameObject.Find("JumpArrow");
|
GameObject jumpArrow = GameObject.Find("JumpArrow");
|
||||||
GameObject restartButton = GameObject.Find("RestartButton");
|
GameObject restartButton = GameObject.Find("RestartButton");
|
||||||
GameObject backButton = GameObject.Find("BackButton");
|
GameObject backButton = GameObject.Find("BackButton");
|
||||||
leftArrow.transform.position = new Vector3(screenWidth / 2.5f, -4f, 0f);
|
leftArrow.transform.position = new UnityEngine.Vector3(screenWidth / 2.5f, -4f, 0f);
|
||||||
rightArrow.transform.position = new Vector3(screenWidth / 2.5f, -4f, 0f);
|
rightArrow.transform.position = new UnityEngine.Vector3(screenWidth / 2.5f, -4f, 0f);
|
||||||
restartButton.transform.position = new Vector3(screenWidth / 2.3f, Camera.main.orthographicSize - 1.2f, 0f);
|
restartButton.transform.position = new UnityEngine.Vector3(screenWidth / 2.3f, Camera.main.orthographicSize - 1.2f, 0f);
|
||||||
backButton.transform.position = new Vector3(-screenWidth / 2.3f, Camera.main.orthographicSize - 1.2f, 0f);
|
backButton.transform.position = new UnityEngine.Vector3(-screenWidth / 2.3f, Camera.main.orthographicSize - 1.2f, 0f);
|
||||||
if (PlayerPrefs.GetInt("Setting3", 0) == 1)
|
if (PlayerPrefs.GetInt("Setting3", 0) == 1)
|
||||||
{
|
{
|
||||||
leftArrow.transform.localScale = new Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
leftArrow.transform.localScale = new UnityEngine.Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
||||||
rightArrow.transform.localScale = new Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
rightArrow.transform.localScale = new UnityEngine.Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
||||||
jumpArrow.transform.localScale = new Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
jumpArrow.transform.localScale = new UnityEngine.Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
||||||
restartButton.transform.localScale = new Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
restartButton.transform.localScale = new UnityEngine.Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
||||||
backButton.transform.localScale = new Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
backButton.transform.localScale = new UnityEngine.Vector3(screenWidth / 14f, screenWidth / 14f, 1f);
|
||||||
jumpArrow.transform.position = new Vector3(screenWidth / 2.5f, -1f, 0f);
|
jumpArrow.transform.position = new UnityEngine.Vector3(screenWidth / 2.5f, -1f, 0f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
leftArrow.transform.localScale = new Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
leftArrow.transform.localScale = new UnityEngine.Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
||||||
rightArrow.transform.localScale = new Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
rightArrow.transform.localScale = new UnityEngine.Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
||||||
jumpArrow.transform.localScale = new Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
jumpArrow.transform.localScale = new UnityEngine.Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
||||||
restartButton.transform.localScale = new Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
restartButton.transform.localScale = new UnityEngine.Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
||||||
backButton.transform.localScale = new Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
backButton.transform.localScale = new UnityEngine.Vector3(screenWidth / 20f, screenWidth / 20f, 1f);
|
||||||
jumpArrow.transform.position = new Vector3(screenWidth / 2.5f, -2f, 0f);
|
jumpArrow.transform.position = new UnityEngine.Vector3(screenWidth / 2.5f, -2f, 0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -399,14 +400,14 @@ public class GamePlayer : MonoBehaviour
|
|||||||
{
|
{
|
||||||
Destroy(berry);
|
Destroy(berry);
|
||||||
}
|
}
|
||||||
else if (Vector3.Distance(bird.transform.position, berry.transform.position) < 1.5f)
|
else if (UnityEngine.Vector3.Distance(bird.transform.position, berry.transform.position) < 1.5f)
|
||||||
{
|
{
|
||||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Eat"), Camera.main.transform.position, 1.2f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Eat"), Camera.main.transform.position, 1.2f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
||||||
Destroy(berry);
|
Destroy(berry);
|
||||||
score++;
|
score++;
|
||||||
UpdateScore(score);
|
UpdateScore(score);
|
||||||
}
|
}
|
||||||
berry.GetComponent<Rigidbody2D>().linearVelocity = new Vector2(0f, -4f);
|
berry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||||
}
|
}
|
||||||
array5 = poisonberries;
|
array5 = poisonberries;
|
||||||
foreach (GameObject gameObject7 in array5)
|
foreach (GameObject gameObject7 in array5)
|
||||||
@@ -415,12 +416,12 @@ public class GamePlayer : MonoBehaviour
|
|||||||
{
|
{
|
||||||
Destroy(gameObject7);
|
Destroy(gameObject7);
|
||||||
}
|
}
|
||||||
else if (Vector3.Distance(bird.transform.position, gameObject7.transform.position) < 1.5f)
|
else if (UnityEngine.Vector3.Distance(bird.transform.position, gameObject7.transform.position) < 1.5f)
|
||||||
{
|
{
|
||||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Death"), Camera.main.transform.position, 1.2f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Death"), Camera.main.transform.position, 1.2f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
||||||
Respawn();
|
Respawn();
|
||||||
}
|
}
|
||||||
gameObject7.GetComponent<Rigidbody2D>().linearVelocity = new Vector2(0f, -4f);
|
gameObject7.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||||
}
|
}
|
||||||
array5 = ultraberries;
|
array5 = ultraberries;
|
||||||
foreach (GameObject gameObject8 in array5)
|
foreach (GameObject gameObject8 in array5)
|
||||||
@@ -429,7 +430,7 @@ public class GamePlayer : MonoBehaviour
|
|||||||
{
|
{
|
||||||
Destroy(gameObject8);
|
Destroy(gameObject8);
|
||||||
}
|
}
|
||||||
else if (Vector3.Distance(bird.transform.position, gameObject8.transform.position) < 1.5f)
|
else if (UnityEngine.Vector3.Distance(bird.transform.position, gameObject8.transform.position) < 1.5f)
|
||||||
{
|
{
|
||||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Powerup"), Camera.main.transform.position, 0.35f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Powerup"), Camera.main.transform.position, 0.35f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
||||||
Destroy(gameObject8);
|
Destroy(gameObject8);
|
||||||
@@ -446,7 +447,7 @@ public class GamePlayer : MonoBehaviour
|
|||||||
UpdateScore(score);
|
UpdateScore(score);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gameObject8.GetComponent<Rigidbody2D>().linearVelocity = new Vector2(0f, -4f);
|
gameObject8.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||||
}
|
}
|
||||||
array5 = slownessberries;
|
array5 = slownessberries;
|
||||||
foreach (GameObject gameObject9 in array5)
|
foreach (GameObject gameObject9 in array5)
|
||||||
@@ -455,7 +456,7 @@ public class GamePlayer : MonoBehaviour
|
|||||||
{
|
{
|
||||||
Destroy(gameObject9);
|
Destroy(gameObject9);
|
||||||
}
|
}
|
||||||
else if (Vector3.Distance(bird.transform.position, gameObject9.transform.position) < 1.5f)
|
else if (UnityEngine.Vector3.Distance(bird.transform.position, gameObject9.transform.position) < 1.5f)
|
||||||
{
|
{
|
||||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Downgrade"), Camera.main.transform.position, 0.35f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Downgrade"), Camera.main.transform.position, 0.35f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
||||||
Destroy(gameObject9);
|
Destroy(gameObject9);
|
||||||
@@ -467,32 +468,32 @@ public class GamePlayer : MonoBehaviour
|
|||||||
UpdateScore(score);
|
UpdateScore(score);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gameObject9.GetComponent<Rigidbody2D>().linearVelocity = new Vector2(0f, -4f);
|
gameObject9.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rb.gravityScale = 0f;
|
rb.gravityScale = 0f;
|
||||||
rb.linearVelocity = Vector2.zero;
|
rb.linearVelocity = UnityEngine.Vector2.zero;
|
||||||
GameObject[] array5 = berries;
|
GameObject[] array5 = berries;
|
||||||
for (int i = 0; i < array5.Length; i++)
|
for (int i = 0; i < array5.Length; i++)
|
||||||
{
|
{
|
||||||
array5[i].GetComponent<Rigidbody2D>().linearVelocity = Vector2.zero;
|
array5[i].GetComponent<Rigidbody2D>().linearVelocity = UnityEngine.Vector2.zero;
|
||||||
}
|
}
|
||||||
array5 = poisonberries;
|
array5 = poisonberries;
|
||||||
for (int i = 0; i < array5.Length; i++)
|
for (int i = 0; i < array5.Length; i++)
|
||||||
{
|
{
|
||||||
array5[i].GetComponent<Rigidbody2D>().linearVelocity = Vector2.zero;
|
array5[i].GetComponent<Rigidbody2D>().linearVelocity = UnityEngine.Vector2.zero;
|
||||||
}
|
}
|
||||||
array5 = ultraberries;
|
array5 = ultraberries;
|
||||||
for (int i = 0; i < array5.Length; i++)
|
for (int i = 0; i < array5.Length; i++)
|
||||||
{
|
{
|
||||||
array5[i].GetComponent<Rigidbody2D>().linearVelocity = Vector2.zero;
|
array5[i].GetComponent<Rigidbody2D>().linearVelocity = UnityEngine.Vector2.zero;
|
||||||
}
|
}
|
||||||
array5 = slownessberries;
|
array5 = slownessberries;
|
||||||
for (int i = 0; i < array5.Length; i++)
|
for (int i = 0; i < array5.Length; i++)
|
||||||
{
|
{
|
||||||
array5[i].GetComponent<Rigidbody2D>().linearVelocity = Vector2.zero;
|
array5[i].GetComponent<Rigidbody2D>().linearVelocity = UnityEngine.Vector2.zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Application.isMobilePlatform && (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.JoystickButton7)))
|
if (!Application.isMobilePlatform && (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.JoystickButton7)))
|
||||||
@@ -503,10 +504,10 @@ public class GamePlayer : MonoBehaviour
|
|||||||
|
|
||||||
void Respawn()
|
void Respawn()
|
||||||
{
|
{
|
||||||
bird.transform.position = new Vector3(0f, -4.3f, 0f);
|
bird.transform.position = new UnityEngine.Vector3(0f, -4.3f, 0f);
|
||||||
bird.transform.localScale = new Vector3(1.35f, 1.35f, 1.35f);
|
bird.transform.localScale = new UnityEngine.Vector3(1.35f, 1.35f, 1.35f);
|
||||||
rb.gravityScale = 0f;
|
rb.gravityScale = 0f;
|
||||||
rb.linearVelocity = Vector2.zero;
|
rb.linearVelocity = UnityEngine.Vector2.zero;
|
||||||
score = 0;
|
score = 0;
|
||||||
boostLeft = 0f;
|
boostLeft = 0f;
|
||||||
slownessLeft = 0f;
|
slownessLeft = 0f;
|
||||||
@@ -534,13 +535,13 @@ public class GamePlayer : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateScore(int score)
|
void UpdateScore(BigInteger score)
|
||||||
{
|
{
|
||||||
if (score > highscore)
|
if (score > highscore)
|
||||||
{
|
{
|
||||||
highscore = score;
|
highscore = score;
|
||||||
}
|
}
|
||||||
PlayerPrefs.SetInt("HighScore", highscore);
|
PlayerPrefs.SetString("HighScoreV2", highscore.ToString());
|
||||||
PlayerPrefs.Save();
|
PlayerPrefs.Save();
|
||||||
scoreText.text = "Score: " + score;
|
scoreText.text = "Score: " + score;
|
||||||
highScoreText.text = "High Score: " + highscore;
|
highScoreText.text = "High Score: " + highscore;
|
||||||
@@ -551,16 +552,16 @@ public class GamePlayer : MonoBehaviour
|
|||||||
GameObject jumpArrow = GameObject.Find("JumpArrow");
|
GameObject jumpArrow = GameObject.Find("JumpArrow");
|
||||||
isGrounded = bird.transform.position.y <= -4.1299996f;
|
isGrounded = bird.transform.position.y <= -4.1299996f;
|
||||||
|
|
||||||
rb.gravityScale = (isGrounded ? 0f : 1.5f);
|
rb.gravityScale = isGrounded ? 0f : 1.5f;
|
||||||
|
|
||||||
if (bird.transform.position.y < -4.1359f)
|
if (bird.transform.position.y < -4.1359f)
|
||||||
{
|
{
|
||||||
bird.transform.position = new Vector2(bird.transform.position.x, -4.1359f);
|
bird.transform.position = new UnityEngine.Vector2(bird.transform.position.x, -4.1359f);
|
||||||
rb.linearVelocity = new Vector2(rb.linearVelocity.x, 0f);
|
rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 0f);
|
||||||
}
|
}
|
||||||
if (jumpArrow != null && jumpArrow.GetComponent<Renderer>() != null)
|
if (jumpArrow != null && jumpArrow.GetComponent<Renderer>() != null)
|
||||||
{
|
{
|
||||||
jumpArrow.GetComponent<Renderer>().material.color = (isGrounded ? Color.white : Color.red);
|
jumpArrow.GetComponent<Renderer>().material.color = isGrounded ? Color.white : Color.red;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,9 +593,9 @@ public class GamePlayer : MonoBehaviour
|
|||||||
pausePanel.SetActive(value: false);
|
pausePanel.SetActive(value: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnApplicationPause()
|
void OnApplicationPause(bool pause)
|
||||||
{
|
{
|
||||||
EnablePause();
|
if (pause) EnablePause();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnApplicationQuit()
|
void OnApplicationQuit()
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
@@ -11,6 +12,11 @@ public class LoadingMenu : MonoBehaviour
|
|||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
|
if (PlayerPrefs.HasKey("HighScore"))
|
||||||
|
{
|
||||||
|
PlayerPrefs.SetString("HighScoreV2", Math.Max(PlayerPrefs.GetInt("HighScore"), 0).ToString());
|
||||||
|
PlayerPrefs.DeleteKey("HighScore");
|
||||||
|
}
|
||||||
Application.targetFrameRate = 360;
|
Application.targetFrameRate = 360;
|
||||||
QualitySettings.vSyncCount = PlayerPrefs.GetInt("Setting5", 1);
|
QualitySettings.vSyncCount = PlayerPrefs.GetInt("Setting5", 1);
|
||||||
Screen.fullScreen = PlayerPrefs.GetInt("Setting1", 1) == 1;
|
Screen.fullScreen = PlayerPrefs.GetInt("Setting1", 1) == 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user