Division Berry
new berry for bdc game
This commit is contained in:
1 parent
c02edbc230
commit
57968c1bbd
4 files changed
+209
-3
No files matched your search
@@ -24,6 +24,7 @@ public class GamePlayer : MonoBehaviour
|
||||
private BigInteger totalPurpleBerries;
|
||||
private BigInteger totalTimeFreezeBerries;
|
||||
private BigInteger totalEvilBerries;
|
||||
private BigInteger totalDivisionBerries;
|
||||
private BigInteger totalAttempts;
|
||||
private float boostLeft;
|
||||
private float slownessLeft;
|
||||
@@ -123,6 +124,7 @@ public class GamePlayer : MonoBehaviour
|
||||
totalPurpleBerries = BazookaManager.Instance.GetGameStoreTotalPurpleBerries();
|
||||
totalTimeFreezeBerries = BazookaManager.Instance.GetGameStoreTotalTimeFreezeBerries();
|
||||
totalEvilBerries = BazookaManager.Instance.GetGameStoreTotalEvilBerries();
|
||||
totalDivisionBerries = BazookaManager.Instance.GetGameStoreTotalDivisionBerries();
|
||||
totalAttempts = BazookaManager.Instance.GetGameStoreTotalAttepts();
|
||||
|
||||
Cursor.visible = false;
|
||||
@@ -230,7 +232,7 @@ public class GamePlayer : MonoBehaviour
|
||||
}
|
||||
if (antiLeft > 0f)
|
||||
{
|
||||
string[] berryTags = { "NormalBerry", "PoisonBerry", "SlowBerry", "UltraBerry", "SpeedyBerry", "RandomBerry", "AntiBerry", "TimeSlowBerry", "PurpleBerry", "TimeFreezeBerry", "EvilBerry" };
|
||||
string[] berryTags = { "NormalBerry", "PoisonBerry", "SlowBerry", "UltraBerry", "SpeedyBerry", "RandomBerry", "AntiBerry", "TimeSlowBerry", "PurpleBerry", "TimeFreezeBerry", "EvilBerry", "DivisionBerry" };
|
||||
foreach (string tag in berryTags)
|
||||
{
|
||||
foreach (var berry in GameObject.FindGameObjectsWithTag(tag))
|
||||
@@ -379,11 +381,16 @@ public class GamePlayer : MonoBehaviour
|
||||
spriteRenderer.sprite = Resources.Load<Sprite>("Berries/TimeFreezeBerry");
|
||||
newBerry.tag = "TimeFreezeBerry";
|
||||
}
|
||||
else
|
||||
else if (spawnProbability <= 0.99f)
|
||||
{
|
||||
spriteRenderer.sprite = Resources.Load<Sprite>("Berries/EvilBerry");
|
||||
newBerry.tag = "EvilBerry";
|
||||
}
|
||||
else
|
||||
{
|
||||
spriteRenderer.sprite = Resources.Load<Sprite>("Berries/DivisionBerry");
|
||||
newBerry.tag = "DivisionBerry";
|
||||
}
|
||||
spriteRenderer.sortingOrder = -5;
|
||||
|
||||
float screenWidth = Camera.main.orthographicSize * 2 * Camera.main.aspect;
|
||||
@@ -417,6 +424,7 @@ public class GamePlayer : MonoBehaviour
|
||||
.Concat(GameObject.FindGameObjectsWithTag("PurpleBerry"))
|
||||
.Concat(GameObject.FindGameObjectsWithTag("TimeFreezeBerry"))
|
||||
.Concat(GameObject.FindGameObjectsWithTag("EvilBerry"))
|
||||
.Concat(GameObject.FindGameObjectsWithTag("DivisionBerry"))
|
||||
.ToArray();
|
||||
foreach (GameObject berry in allberries)
|
||||
{
|
||||
@@ -434,6 +442,7 @@ public class GamePlayer : MonoBehaviour
|
||||
GameObject[] purpleBerries = GameObject.FindGameObjectsWithTag("PurpleBerry");
|
||||
GameObject[] timeFreezeBerries = GameObject.FindGameObjectsWithTag("TimeFreezeBerry");
|
||||
GameObject[] evilBerries = GameObject.FindGameObjectsWithTag("EvilBerry");
|
||||
GameObject[] divisionBerries = GameObject.FindGameObjectsWithTag("DivisionBerry");
|
||||
|
||||
if (!pausePanel.activeSelf)
|
||||
{
|
||||
@@ -758,6 +767,34 @@ public class GamePlayer : MonoBehaviour
|
||||
evilBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||
}
|
||||
}
|
||||
foreach (GameObject divisionBerry in divisionBerries)
|
||||
{
|
||||
if (divisionBerry.transform.position.y < 0f - Camera.main.orthographicSize - 1f)
|
||||
{
|
||||
Destroy(divisionBerry);
|
||||
}
|
||||
else if (UnityEngine.Vector3.Distance(bird.transform.position, divisionBerry.transform.position) < 1.5f)
|
||||
{
|
||||
totalDivisionBerries++;
|
||||
DoDivisionBerry(divisionBerry);
|
||||
}
|
||||
if (timeFreezeLeft > 0)
|
||||
{
|
||||
divisionBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, 0f);
|
||||
}
|
||||
else if (timeSlowLeft > 0)
|
||||
{
|
||||
divisionBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -2f);
|
||||
}
|
||||
else if (speedyLeft > 0)
|
||||
{
|
||||
divisionBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
divisionBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -774,6 +811,7 @@ public class GamePlayer : MonoBehaviour
|
||||
.Concat(purpleBerries)
|
||||
.Concat(timeFreezeBerries)
|
||||
.Concat(evilBerries)
|
||||
.Concat(divisionBerries)
|
||||
.ToArray();
|
||||
foreach (GameObject berry in allberries)
|
||||
{
|
||||
@@ -809,6 +847,7 @@ public class GamePlayer : MonoBehaviour
|
||||
.Concat(GameObject.FindGameObjectsWithTag("PurpleBerry"))
|
||||
.Concat(GameObject.FindGameObjectsWithTag("TimeFreezeBerry"))
|
||||
.Concat(GameObject.FindGameObjectsWithTag("EvilBerry"))
|
||||
.Concat(GameObject.FindGameObjectsWithTag("DivisionBerry"))
|
||||
.ToArray();
|
||||
foreach (GameObject berry in allberries)
|
||||
{
|
||||
@@ -841,6 +880,7 @@ public class GamePlayer : MonoBehaviour
|
||||
BazookaManager.Instance.SetGameStoreTotalPurpleBerries(totalPurpleBerries);
|
||||
BazookaManager.Instance.SetGameStoreTotalTimeFreezeBerries(totalTimeFreezeBerries);
|
||||
BazookaManager.Instance.SetGameStoreTotalEvilBerries(totalEvilBerries);
|
||||
BazookaManager.Instance.SetGameStoreTotalDivisionBerries(totalDivisionBerries);
|
||||
BazookaManager.Instance.SetGameStoreTotalAttepts(totalAttempts);
|
||||
scoreText.text = $"Score: {Tools.FormatWithCommas(score)} \\u2022 Attempts: {Tools.FormatWithCommas(attempts)}";
|
||||
highScoreText.text = prefix + $"High Score: {Tools.FormatWithCommas(highscore) + suffix} \\u2022 Total Attempts: {Tools.FormatWithCommas(totalAttempts)}";
|
||||
@@ -1022,4 +1062,11 @@ public class GamePlayer : MonoBehaviour
|
||||
score = 0;
|
||||
}
|
||||
}
|
||||
void DoDivisionBerry(GameObject berry)
|
||||
{
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Downgrade"), Camera.main.transform.position, 1.2f * BazookaManager.Instance.GetSettingSFXVolume());
|
||||
Destroy(berry);
|
||||
score = score / 2;
|
||||
UpdateStats(0, 0);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user