time freeze berry added

This commit is contained in:
happy-bob007 committed 2025-09-10 18:01:34 -05:00
1 parent 3016f8fa84
commit 6ad6857599
5 files changed
+284 -17

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

@@ -0,0 +1,156 @@
fileFormatVersion: 2
guid: 185d97954c8bfbb4db23135a717cb44e
TextureImporter:
internalIDToNameTable:
- first:
213: -5096348764422709229
second: timefreezeberry_0
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: timefreezeberry_0
rect:
serializedVersion: 2
x: 7
y: 3
width: 114
height: 122
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 3106515ecc12649b0800000000000000
internalID: -5096348764422709229
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
timefreezeberry_0: -5096348764422709229
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
+18
View File
@@ -492,4 +492,22 @@ public class BazookaManager : MonoBehaviour
if (saveFile["gameStore"] == null) return; if (saveFile["gameStore"] == null) return;
(saveFile["gameStore"] as JObject)?.Remove("totalPurpleBerries"); (saveFile["gameStore"] as JObject)?.Remove("totalPurpleBerries");
} }
public void SetGameStoreTotalTimeFreezeBerries(BigInteger value)
{
if (saveFile["gameStore"] == null) saveFile["gameStore"] = new JObject();
saveFile["gameStore"]["totalTimeFreezeBerries"] = value.ToString();
}
public BigInteger GetGameStoreTotalTimeFreezeBerries()
{
if (saveFile["gameStore"] == null) return 0;
if (saveFile["gameStore"]["totalTimeFreezeBerries"] == null) return 0;
return BigInteger.Parse(saveFile["gameStore"]["totalTimeFreezeBerries"].ToString());
}
public void UnsetGameStoreTotalTimeFreezeBerries()
{
if (saveFile["gameStore"] == null) return;
(saveFile["gameStore"] as JObject)?.Remove("totalTimeFreezeBerries");
}
} }
+109 -17
View File
@@ -20,9 +20,11 @@ public class GamePlayer : MonoBehaviour
private BigInteger totalSpeedyBerries; private BigInteger totalSpeedyBerries;
private BigInteger totalTimeSlowBerries; private BigInteger totalTimeSlowBerries;
private BigInteger totalPurpleBerries; private BigInteger totalPurpleBerries;
private BigInteger totalTimeFreezeBerries;
private BigInteger totalAttempts; private BigInteger totalAttempts;
private float boostLeft; private float boostLeft;
private float timeslowLeft; private float timeslowLeft;
private float timefreezeLeft;
private float slownessLeft; private float slownessLeft;
private float speedyLeft; private float speedyLeft;
private float screenWidth; private float screenWidth;
@@ -272,6 +274,11 @@ public class GamePlayer : MonoBehaviour
timeslowLeft -= Time.deltaTime; timeslowLeft -= Time.deltaTime;
boostText.text = "Time Slow expires in " + string.Format("{0:0.0}", timeslowLeft) + "s"; boostText.text = "Time Slow expires in " + string.Format("{0:0.0}", timeslowLeft) + "s";
} }
else if (timefreezeLeft > 0f)
{
timefreezeLeft -= Time.deltaTime;
boostText.text = "Time Freeze expires in " + string.Format("{0:0.0}", timefreezeLeft) + "s";
}
else else
{ {
boostText.text = ""; boostText.text = "";
@@ -294,11 +301,13 @@ public class GamePlayer : MonoBehaviour
nextSpawnTime = Time.time + 1f / spawnRate; nextSpawnTime = Time.time + 1f / spawnRate;
} }
float spawnProbability = Random.value; float spawnProbability = Random.value;
if ((int)timefreezeLeft != 0) return;
if (!pausePanel.activeSelf) if (!pausePanel.activeSelf)
{ {
GameObject newBerry = new("Berry"); GameObject newBerry = new("Berry");
newBerry.transform.SetParent(berryParent.transform); newBerry.transform.SetParent(berryParent.transform);
SpriteRenderer spriteRenderer = newBerry.AddComponent<SpriteRenderer>(); SpriteRenderer spriteRenderer = newBerry.AddComponent<SpriteRenderer>();
if (spawnProbability <= 0.525f) if (spawnProbability <= 0.525f)
{ {
spriteRenderer.sprite = Resources.Load<Sprite>("Berries/Berry"); spriteRenderer.sprite = Resources.Load<Sprite>("Berries/Berry");
@@ -329,13 +338,16 @@ public class GamePlayer : MonoBehaviour
spriteRenderer.sprite = Resources.Load<Sprite>("Berries/PurpleBerry"); spriteRenderer.sprite = Resources.Load<Sprite>("Berries/PurpleBerry");
newBerry.tag = "PurpleBerry"; newBerry.tag = "PurpleBerry";
} }
else else if (spawnProbability <= 0.985f)
{ {
spriteRenderer.sprite = Resources.Load<Sprite>("Berries/TimeSlowBerry"); spriteRenderer.sprite = Resources.Load<Sprite>("Berries/TimeSlowBerry");
newBerry.tag = "TimeSlowBerry"; newBerry.tag = "TimeSlowBerry";
} }
else
{
spriteRenderer.sprite = Resources.Load<Sprite>("Berries/TimeFreezeBerry");
newBerry.tag = "TimeFreezeBerry";
}
spriteRenderer.sortingOrder = -5; spriteRenderer.sortingOrder = -5;
@@ -369,6 +381,7 @@ public class GamePlayer : MonoBehaviour
GameObject[] speedyBerries = GameObject.FindGameObjectsWithTag("SpeedyBerry"); GameObject[] speedyBerries = GameObject.FindGameObjectsWithTag("SpeedyBerry");
GameObject[] timeslowBerries = GameObject.FindGameObjectsWithTag("TimeSlowBerry"); GameObject[] timeslowBerries = GameObject.FindGameObjectsWithTag("TimeSlowBerry");
GameObject[] purpleBerries = GameObject.FindGameObjectsWithTag("PurpleBerry"); GameObject[] purpleBerries = GameObject.FindGameObjectsWithTag("PurpleBerry");
GameObject[] timefreezeBerries = GameObject.FindGameObjectsWithTag("TimeFreezeBerry");
if (!pausePanel.activeSelf) if (!pausePanel.activeSelf)
{ {
@@ -391,7 +404,12 @@ public class GamePlayer : MonoBehaviour
totalNormalBerries++; totalNormalBerries++;
UpdateStats(1, 0); UpdateStats(1, 0);
} }
if (speedyLeft > 0)
if (timefreezeLeft > 0)
{
normalBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, 0f);
}
else if (speedyLeft > 0)
{ {
normalBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f); normalBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f);
} }
@@ -401,10 +419,10 @@ public class GamePlayer : MonoBehaviour
} }
else else
{ {
normalBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f); normalBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
} }
} }
foreach (GameObject poisonBerry in poisonBerries) foreach (GameObject poisonBerry in poisonBerries)
{ {
if (poisonBerry.transform.position.y < 0f - Camera.main.orthographicSize - 1f) if (poisonBerry.transform.position.y < 0f - Camera.main.orthographicSize - 1f)
@@ -418,7 +436,12 @@ public class GamePlayer : MonoBehaviour
totalPoisonBerries++; totalPoisonBerries++;
UpdateStats(0, 0); UpdateStats(0, 0);
} }
if (speedyLeft > 0)
if (timefreezeLeft > 0)
{
poisonBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, 0f);
}
else if (speedyLeft > 0)
{ {
poisonBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f); poisonBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f);
} }
@@ -428,9 +451,10 @@ public class GamePlayer : MonoBehaviour
} }
else else
{ {
poisonBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f); poisonBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
} }
} }
foreach (GameObject slowBerry in slowBerries) foreach (GameObject slowBerry in slowBerries)
{ {
if (slowBerry.transform.position.y < 0f - Camera.main.orthographicSize - 1f) if (slowBerry.transform.position.y < 0f - Camera.main.orthographicSize - 1f)
@@ -450,7 +474,12 @@ public class GamePlayer : MonoBehaviour
UpdateStats(-1, 0); UpdateStats(-1, 0);
} }
} }
if (speedyLeft > 0)
if (timefreezeLeft > 0)
{
slowBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, 0f);
}
else if (speedyLeft > 0)
{ {
slowBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f); slowBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f);
} }
@@ -460,9 +489,10 @@ public class GamePlayer : MonoBehaviour
} }
else else
{ {
slowBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f); slowBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
} }
} }
foreach (GameObject ultraBerry in ultraBerries) foreach (GameObject ultraBerry in ultraBerries)
{ {
if (ultraBerry.transform.position.y < 0f - Camera.main.orthographicSize - 1f) if (ultraBerry.transform.position.y < 0f - Camera.main.orthographicSize - 1f)
@@ -487,7 +517,12 @@ public class GamePlayer : MonoBehaviour
UpdateStats(5, 0); UpdateStats(5, 0);
} }
} }
if (speedyLeft > 0)
if (timefreezeLeft > 0)
{
ultraBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, 0f);
}
else if (speedyLeft > 0)
{ {
ultraBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f); ultraBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f);
} }
@@ -497,9 +532,10 @@ public class GamePlayer : MonoBehaviour
} }
else else
{ {
ultraBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f); ultraBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
} }
} }
foreach (GameObject speedyBerry in speedyBerries) foreach (GameObject speedyBerry in speedyBerries)
{ {
if (speedyBerry.transform.position.y < 0f - Camera.main.orthographicSize - 1f) if (speedyBerry.transform.position.y < 0f - Camera.main.orthographicSize - 1f)
@@ -517,7 +553,12 @@ public class GamePlayer : MonoBehaviour
totalSpeedyBerries++; totalSpeedyBerries++;
UpdateStats(10, 0); UpdateStats(10, 0);
} }
if (speedyLeft > 0)
if (timefreezeLeft > 0)
{
speedyBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, 0f);
}
else if (speedyLeft > 0)
{ {
speedyBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f); speedyBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f);
} }
@@ -527,9 +568,10 @@ public class GamePlayer : MonoBehaviour
} }
else else
{ {
speedyBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f); speedyBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
} }
} }
foreach (GameObject timeslowBerry in timeslowBerries) foreach (GameObject timeslowBerry in timeslowBerries)
{ {
if (timeslowBerry.transform.position.y < 0f - Camera.main.orthographicSize - 1f) if (timeslowBerry.transform.position.y < 0f - Camera.main.orthographicSize - 1f)
@@ -546,7 +588,12 @@ public class GamePlayer : MonoBehaviour
totalTimeSlowBerries++; totalTimeSlowBerries++;
UpdateStats(1, 0); UpdateStats(1, 0);
} }
if (speedyLeft > 0)
if (timefreezeLeft > 0)
{
timeslowBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, 0f);
}
else if (speedyLeft > 0)
{ {
timeslowBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f); timeslowBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f);
} }
@@ -556,9 +603,10 @@ public class GamePlayer : MonoBehaviour
} }
else else
{ {
timeslowBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f); timeslowBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
} }
} }
foreach (GameObject purpleBerry in purpleBerries) foreach (GameObject purpleBerry in purpleBerries)
{ {
if (purpleBerry.transform.position.y < 0f - Camera.main.orthographicSize - 1f) if (purpleBerry.transform.position.y < 0f - Camera.main.orthographicSize - 1f)
@@ -572,7 +620,12 @@ public class GamePlayer : MonoBehaviour
totalPurpleBerries++; totalPurpleBerries++;
UpdateStats(15, 0); UpdateStats(15, 0);
} }
if (speedyLeft > 0)
if (timefreezeLeft > 0)
{
purpleBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, 0f);
}
else if (speedyLeft > 0)
{ {
purpleBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f); purpleBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f);
} }
@@ -585,6 +638,42 @@ public class GamePlayer : MonoBehaviour
purpleBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f); purpleBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
} }
} }
foreach (GameObject timefreezeBerry in timefreezeBerries)
{
if (timefreezeBerry.transform.position.y < 0f - Camera.main.orthographicSize - 1f)
{
Destroy(timefreezeBerry);
}
else if (UnityEngine.Vector3.Distance(bird.transform.position, timefreezeBerry.transform.position) < 1.5f)
{
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Eat"), Camera.main.transform.position, 1.2f * BazookaManager.Instance.GetSettingSFXVolume());
Destroy(timefreezeBerry);
boostLeft = 0f;
speedyLeft = 0f;
timeslowLeft = 0f;
timefreezeLeft = 5f;
totalTimeFreezeBerries++;
}
if (timefreezeLeft > 0)
{
timefreezeBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, 0f);
}
else if (speedyLeft > 0)
{
timefreezeBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f);
}
else if (timeslowLeft > 0)
{
timefreezeBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -2f);
}
else
{
timefreezeBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
}
}
} }
else else
{ {
@@ -597,6 +686,7 @@ public class GamePlayer : MonoBehaviour
.Concat(speedyBerries) .Concat(speedyBerries)
.Concat(timeslowBerries) .Concat(timeslowBerries)
.Concat(purpleBerries) .Concat(purpleBerries)
.Concat(timefreezeBerries)
.ToArray(); .ToArray();
foreach (GameObject berry in allberries) foreach (GameObject berry in allberries)
{ {
@@ -615,6 +705,7 @@ public class GamePlayer : MonoBehaviour
score = 0; score = 0;
boostLeft = 0f; boostLeft = 0f;
timeslowLeft = 0f; timeslowLeft = 0f;
timefreezeLeft = 0f;
slownessLeft = 0f; slownessLeft = 0f;
speedyLeft = 0f; speedyLeft = 0f;
UpdateStats(0, 1); UpdateStats(0, 1);
@@ -626,6 +717,7 @@ public class GamePlayer : MonoBehaviour
.Concat(GameObject.FindGameObjectsWithTag("SpeedyBerry")) .Concat(GameObject.FindGameObjectsWithTag("SpeedyBerry"))
.Concat(GameObject.FindGameObjectsWithTag("TimeSlowBerry")) .Concat(GameObject.FindGameObjectsWithTag("TimeSlowBerry"))
.Concat(GameObject.FindGameObjectsWithTag("PurpleBerry")) .Concat(GameObject.FindGameObjectsWithTag("PurpleBerry"))
.Concat(GameObject.FindGameObjectsWithTag("TimeFreezeBerry"))
.ToArray(); .ToArray();
foreach (GameObject berry in allberries) foreach (GameObject berry in allberries)
{ {
+1
View File
@@ -17,6 +17,7 @@ public class StatsMenu : MonoBehaviour
text.AppendLine("Total Speedy Berries: " + Tools.FormatWithCommas(BazookaManager.Instance.GetGameStoreTotalSpeedyBerries())); text.AppendLine("Total Speedy Berries: " + Tools.FormatWithCommas(BazookaManager.Instance.GetGameStoreTotalSpeedyBerries()));
text.AppendLine("Total Time Slow Berries: " + Tools.FormatWithCommas(BazookaManager.Instance.GetGameStoreTotalTimeSlowBerries())); text.AppendLine("Total Time Slow Berries: " + Tools.FormatWithCommas(BazookaManager.Instance.GetGameStoreTotalTimeSlowBerries()));
text.AppendLine("Total Purple Berries: " + Tools.FormatWithCommas(BazookaManager.Instance.GetGameStoreTotalPurpleBerries())); text.AppendLine("Total Purple Berries: " + Tools.FormatWithCommas(BazookaManager.Instance.GetGameStoreTotalPurpleBerries()));
text.AppendLine("Total Time Freeze Berries: " + Tools.FormatWithCommas(BazookaManager.Instance.GetGameStoreTotalTimeFreezeBerries()));
text.AppendLine("Total Attempts: " + Tools.FormatWithCommas(BazookaManager.Instance.GetGameStoreTotalAttepts())); text.AppendLine("Total Attempts: " + Tools.FormatWithCommas(BazookaManager.Instance.GetGameStoreTotalAttepts()));
statText.text = text.ToString(); statText.text = text.ToString();
} }