Add speedyberry + Update unity
This commit is contained in:
BIN
Assets/Resources/Berries/SpeedyBerry.png
Normal file
BIN
Assets/Resources/Berries/SpeedyBerry.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
169
Assets/Resources/Berries/SpeedyBerry.png.meta
Normal file
169
Assets/Resources/Berries/SpeedyBerry.png.meta
Normal file
@@ -0,0 +1,169 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59235d26eca651e63a56cb40b86e7afb
|
||||
TextureImporter:
|
||||
internalIDToNameTable:
|
||||
- first:
|
||||
213: -2055337169336843231
|
||||
second: SpeedyBerry_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
|
||||
- serializedVersion: 4
|
||||
buildTarget: WebGL
|
||||
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: SpeedyBerry_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: 1244500fbb9f973e0800000000000000
|
||||
internalID: -2055337169336843231
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable:
|
||||
SpeedyBerry_0: -2055337169336843231
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Sounds/SpeedyPowerup.mp3
Normal file
BIN
Assets/Resources/Sounds/SpeedyPowerup.mp3
Normal file
Binary file not shown.
23
Assets/Resources/Sounds/SpeedyPowerup.mp3.meta
Normal file
23
Assets/Resources/Sounds/SpeedyPowerup.mp3.meta
Normal file
@@ -0,0 +1,23 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e56f4cb5d9e3aaa48eb0b56a5f15ddc
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 8
|
||||
defaultSettings:
|
||||
serializedVersion: 2
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
preloadAudioData: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -14,8 +14,10 @@ public class GamePlayer : MonoBehaviour
|
||||
private BigInteger totalPoisonBerries;
|
||||
private BigInteger totalSlowBerries;
|
||||
private BigInteger totalUltraBerries;
|
||||
private BigInteger totalSpeedyBerries;
|
||||
private float boostLeft;
|
||||
private float slownessLeft;
|
||||
private float speedyLeft;
|
||||
private float screenWidth;
|
||||
private bool isGrounded;
|
||||
public TMP_Text scoreText;
|
||||
@@ -46,6 +48,7 @@ public class GamePlayer : MonoBehaviour
|
||||
totalPoisonBerries = BigInteger.Parse(PlayerPrefs.GetString("TotalPoisonBerries", "0"));
|
||||
totalSlowBerries = BigInteger.Parse(PlayerPrefs.GetString("TotalSlowBerries", "0"));
|
||||
totalUltraBerries = BigInteger.Parse(PlayerPrefs.GetString("TotalUltraBerries", "0"));
|
||||
totalSpeedyBerries = BigInteger.Parse(PlayerPrefs.GetString("TotalSpeedyBerries", "0"));
|
||||
}
|
||||
|
||||
void Start()
|
||||
@@ -154,7 +157,7 @@ public class GamePlayer : MonoBehaviour
|
||||
bool doRestart = false;
|
||||
bool doBack = false;
|
||||
float movespeed = baseSpeed;
|
||||
if (boostLeft > 0f)
|
||||
if (boostLeft > 0f || speedyLeft > 0f)
|
||||
{
|
||||
movespeed = baseSpeed * 1.39f;
|
||||
}
|
||||
@@ -320,6 +323,11 @@ public class GamePlayer : MonoBehaviour
|
||||
slownessLeft -= Time.deltaTime;
|
||||
boostText.text = "Slowness expires in " + $"{slownessLeft:0.0}" + "s";
|
||||
}
|
||||
else if (speedyLeft > 0f)
|
||||
{
|
||||
speedyLeft -= Time.deltaTime;
|
||||
boostText.text = "Speed expires in " + $"{speedyLeft:0.0}" + "s";
|
||||
}
|
||||
else
|
||||
{
|
||||
boostText.text = "";
|
||||
@@ -346,27 +354,34 @@ public class GamePlayer : MonoBehaviour
|
||||
spriteRenderer.sprite = Resources.Load<Sprite>("Berries/Berry");
|
||||
newBerry.tag = "Berry";
|
||||
}
|
||||
else if (spawnProbability <= 0.8f)
|
||||
else if (spawnProbability <= 0.7f)
|
||||
{
|
||||
newBerry = new GameObject("PoisonBerry");
|
||||
spriteRenderer = newBerry.AddComponent<SpriteRenderer>();
|
||||
spriteRenderer.sprite = Resources.Load<Sprite>("Berries/PoisonBerry");
|
||||
newBerry.tag = "PoisonBerry";
|
||||
}
|
||||
else if (spawnProbability <= 0.9f)
|
||||
else if (spawnProbability <= 0.8f)
|
||||
{
|
||||
newBerry = new GameObject("SlowBerry");
|
||||
spriteRenderer = newBerry.AddComponent<SpriteRenderer>();
|
||||
spriteRenderer.sprite = Resources.Load<Sprite>("Berries/SlowBerry");
|
||||
newBerry.tag = "SlowBerry";
|
||||
}
|
||||
else
|
||||
else if (spawnProbability <= 0.9f)
|
||||
{
|
||||
newBerry = new GameObject("UltraBerry");
|
||||
spriteRenderer = newBerry.AddComponent<SpriteRenderer>();
|
||||
spriteRenderer.sprite = Resources.Load<Sprite>("Berries/UltraBerry");
|
||||
newBerry.tag = "UltraBerry";
|
||||
}
|
||||
else
|
||||
{
|
||||
newBerry = new GameObject("SpeedyBerry");
|
||||
spriteRenderer = newBerry.AddComponent<SpriteRenderer>();
|
||||
spriteRenderer.sprite = Resources.Load<Sprite>("Berries/SpeedyBerry");
|
||||
newBerry.tag = "SpeedyBerry";
|
||||
}
|
||||
spriteRenderer.sortingOrder = -5;
|
||||
|
||||
float screenWidth = Camera.main.orthographicSize * 2 * Camera.main.aspect;
|
||||
@@ -410,6 +425,7 @@ public class GamePlayer : MonoBehaviour
|
||||
GameObject[] poisonberries = GameObject.FindGameObjectsWithTag("PoisonBerry");
|
||||
GameObject[] ultraberries = GameObject.FindGameObjectsWithTag("UltraBerry");
|
||||
GameObject[] slownessberries = GameObject.FindGameObjectsWithTag("SlowBerry");
|
||||
GameObject[] speedyberries = GameObject.FindGameObjectsWithTag("SpeedyBerry");
|
||||
if (!pausePanel.activeSelf)
|
||||
{
|
||||
if (Time.time - lastMoveTime > 20)
|
||||
@@ -432,7 +448,14 @@ public class GamePlayer : MonoBehaviour
|
||||
totalNormalBerries++;
|
||||
UpdateStats(1);
|
||||
}
|
||||
berry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||
if (speedyLeft > 0)
|
||||
{
|
||||
berry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
berry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||
}
|
||||
}
|
||||
array5 = poisonberries;
|
||||
foreach (GameObject gameObject7 in array5)
|
||||
@@ -448,7 +471,14 @@ public class GamePlayer : MonoBehaviour
|
||||
totalPoisonBerries++;
|
||||
UpdateStats(0);
|
||||
}
|
||||
gameObject7.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||
if (speedyLeft > 0)
|
||||
{
|
||||
gameObject7.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObject7.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||
}
|
||||
}
|
||||
array5 = ultraberries;
|
||||
foreach (GameObject gameObject8 in array5)
|
||||
@@ -462,6 +492,7 @@ public class GamePlayer : MonoBehaviour
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Powerup"), Camera.main.transform.position, 0.35f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
||||
Destroy(gameObject8);
|
||||
totalUltraBerries++;
|
||||
speedyLeft = 0f;
|
||||
if (slownessLeft > 0f)
|
||||
{
|
||||
slownessLeft = 0f;
|
||||
@@ -473,7 +504,14 @@ public class GamePlayer : MonoBehaviour
|
||||
UpdateStats(5);
|
||||
}
|
||||
}
|
||||
gameObject8.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||
if (speedyLeft > 0)
|
||||
{
|
||||
gameObject8.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObject8.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||
}
|
||||
}
|
||||
array5 = slownessberries;
|
||||
foreach (GameObject gameObject9 in array5)
|
||||
@@ -488,13 +526,47 @@ public class GamePlayer : MonoBehaviour
|
||||
Destroy(gameObject9);
|
||||
boostLeft = 0f;
|
||||
slownessLeft = 10f;
|
||||
speedyLeft = 0f;
|
||||
totalSlowBerries++;
|
||||
if (score > 0)
|
||||
{
|
||||
UpdateStats(-1);
|
||||
}
|
||||
}
|
||||
gameObject9.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||
if (speedyLeft > 0)
|
||||
{
|
||||
gameObject9.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObject9.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||
}
|
||||
}
|
||||
array5 = speedyberries;
|
||||
foreach (GameObject gameObject10 in array5)
|
||||
{
|
||||
if (gameObject10.transform.position.y < 0f - Camera.main.orthographicSize - 1f)
|
||||
{
|
||||
Destroy(gameObject10);
|
||||
}
|
||||
else if (UnityEngine.Vector3.Distance(bird.transform.position, gameObject10.transform.position) < 1.5f)
|
||||
{
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/SpeedyPowerup"), Camera.main.transform.position, 0.35f * PlayerPrefs.GetFloat("sfxVolume", 1f));
|
||||
Destroy(gameObject10);
|
||||
boostLeft = 0f;
|
||||
slownessLeft = 0f;
|
||||
speedyLeft = 10f;
|
||||
totalSpeedyBerries++;
|
||||
UpdateStats(10);
|
||||
}
|
||||
if (speedyLeft > 0)
|
||||
{
|
||||
gameObject10.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObject10.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -521,6 +593,11 @@ public class GamePlayer : MonoBehaviour
|
||||
{
|
||||
array5[i].GetComponent<Rigidbody2D>().linearVelocity = UnityEngine.Vector2.zero;
|
||||
}
|
||||
array5 = speedyberries;
|
||||
for (int i = 0; i < array5.Length; i++)
|
||||
{
|
||||
array5[i].GetComponent<Rigidbody2D>().linearVelocity = UnityEngine.Vector2.zero;
|
||||
}
|
||||
}
|
||||
if (!Application.isMobilePlatform && (Keyboard.current.escapeKey.wasPressedThisFrame || (Gamepad.current != null && (Gamepad.current.startButton.wasPressedThisFrame || Gamepad.current.buttonEast.wasPressedThisFrame))))
|
||||
{
|
||||
@@ -542,6 +619,7 @@ public class GamePlayer : MonoBehaviour
|
||||
GameObject[] poisonberries = GameObject.FindGameObjectsWithTag("PoisonBerry");
|
||||
GameObject[] ultraberries = GameObject.FindGameObjectsWithTag("UltraBerry");
|
||||
GameObject[] slownessberries = GameObject.FindGameObjectsWithTag("SlowBerry");
|
||||
GameObject[] speedyberries = GameObject.FindGameObjectsWithTag("SpeedyBerry");
|
||||
|
||||
foreach (GameObject b in berries)
|
||||
{
|
||||
@@ -559,6 +637,10 @@ public class GamePlayer : MonoBehaviour
|
||||
{
|
||||
Destroy(sb);
|
||||
}
|
||||
foreach (GameObject syb in speedyberries)
|
||||
{
|
||||
Destroy(syb);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateStats(BigInteger toAdd)
|
||||
@@ -573,6 +655,7 @@ public class GamePlayer : MonoBehaviour
|
||||
PlayerPrefs.SetString("TotalPoisonBerries", totalPoisonBerries.ToString());
|
||||
PlayerPrefs.SetString("TotalSlowBerries", totalSlowBerries.ToString());
|
||||
PlayerPrefs.SetString("TotalUltraBerries", totalUltraBerries.ToString());
|
||||
PlayerPrefs.SetString("TotalSpeedyBerries", totalSpeedyBerries.ToString());
|
||||
PlayerPrefs.Save();
|
||||
scoreText.text = "Score: " + Tools.FormatWithCommas(score);
|
||||
highScoreText.text = "High Score: " + Tools.FormatWithCommas(highscore);
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
m_EditorVersion: 6000.1.5f1
|
||||
m_EditorVersionWithRevision: 6000.1.5f1 (923722cbbcfc)
|
||||
m_EditorVersion: 6000.1.6f1
|
||||
m_EditorVersionWithRevision: 6000.1.6f1 (d64b1a599cad)
|
||||
|
||||
@@ -8,6 +8,7 @@ TagManager:
|
||||
- PoisonBerry
|
||||
- SlowBerry
|
||||
- UltraBerry
|
||||
- SpeedyBerry
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
|
||||
Reference in New Issue
Block a user