Finish nothing berry
This commit is contained in:
@@ -552,7 +552,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!224 &164218987
|
--- !u!224 &164218987
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -1385,7 +1385,7 @@ RectTransform:
|
|||||||
m_AnchorMin: {x: 0.5, y: 1}
|
m_AnchorMin: {x: 0.5, y: 1}
|
||||||
m_AnchorMax: {x: 0.5, y: 1}
|
m_AnchorMax: {x: 0.5, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: -100}
|
m_AnchoredPosition: {x: 0, y: -100}
|
||||||
m_SizeDelta: {x: 0, y: 0}
|
m_SizeDelta: {x: 658.25, y: 45.01}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!114 &459138108
|
--- !u!114 &459138108
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@@ -2192,6 +2192,7 @@ MonoBehaviour:
|
|||||||
speedyBerryChance: {fileID: 1878332340}
|
speedyBerryChance: {fileID: 1878332340}
|
||||||
randomBerryChance: {fileID: 2018765150}
|
randomBerryChance: {fileID: 2018765150}
|
||||||
antiBerryChance: {fileID: 1230511725}
|
antiBerryChance: {fileID: 1230511725}
|
||||||
|
nothingBerryChance: {fileID: 830548777}
|
||||||
validateTotalText: {fileID: 598155839}
|
validateTotalText: {fileID: 598155839}
|
||||||
jumpscareImage: {fileID: 972157958}
|
jumpscareImage: {fileID: 972157958}
|
||||||
jumpscareAudio: {fileID: 1202270393}
|
jumpscareAudio: {fileID: 1202270393}
|
||||||
@@ -3392,7 +3393,7 @@ MonoBehaviour:
|
|||||||
m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||||
m_CustomCaretColor: 0
|
m_CustomCaretColor: 0
|
||||||
m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412}
|
m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412}
|
||||||
m_Text: 5%
|
m_Text: 0%
|
||||||
m_CaretBlinkRate: 0.85
|
m_CaretBlinkRate: 0.85
|
||||||
m_CaretWidth: 1
|
m_CaretWidth: 1
|
||||||
m_ReadOnly: 0
|
m_ReadOnly: 0
|
||||||
@@ -5052,7 +5053,7 @@ RectTransform:
|
|||||||
m_AnchorMin: {x: 0.5, y: 1}
|
m_AnchorMin: {x: 0.5, y: 1}
|
||||||
m_AnchorMax: {x: 0.5, y: 1}
|
m_AnchorMax: {x: 0.5, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: -100}
|
m_AnchoredPosition: {x: 0, y: -100}
|
||||||
m_SizeDelta: {x: 400.43, y: 70.01}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!114 &1447186681
|
--- !u!114 &1447186681
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@@ -6074,7 +6075,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 0
|
m_IsActive: 1
|
||||||
--- !u!224 &1723463929
|
--- !u!224 &1723463929
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public class CustomGamePlayer : MonoBehaviour
|
|||||||
private float speedyBerryChance;
|
private float speedyBerryChance;
|
||||||
private float randomBerryChance;
|
private float randomBerryChance;
|
||||||
private float antiBerryChance;
|
private float antiBerryChance;
|
||||||
|
private float nothingBerryChance;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
@@ -61,6 +62,7 @@ public class CustomGamePlayer : MonoBehaviour
|
|||||||
speedyBerryChance = customGameTempData.speedyBerryChance;
|
speedyBerryChance = customGameTempData.speedyBerryChance;
|
||||||
randomBerryChance = customGameTempData.randomBerryChance;
|
randomBerryChance = customGameTempData.randomBerryChance;
|
||||||
antiBerryChance = customGameTempData.antiBerryChance;
|
antiBerryChance = customGameTempData.antiBerryChance;
|
||||||
|
nothingBerryChance = customGameTempData.nothingBerryChance;
|
||||||
Destroy(customGameTempData.gameObject);
|
Destroy(customGameTempData.gameObject);
|
||||||
|
|
||||||
var backgroundColor = BazookaManager.Instance.GetColorSettingBackground();
|
var backgroundColor = BazookaManager.Instance.GetColorSettingBackground();
|
||||||
@@ -389,6 +391,13 @@ public class CustomGamePlayer : MonoBehaviour
|
|||||||
newBerry.tag = "AntiBerry";
|
newBerry.tag = "AntiBerry";
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
cumulative += nothingBerryChance / 100f;
|
||||||
|
if (spawnProbability <= cumulative)
|
||||||
|
{
|
||||||
|
spriteRenderer.sprite = Resources.Load<Sprite>("Berries/BerryNoColor");
|
||||||
|
newBerry.tag = "NothingBerry";
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
finish:
|
finish:
|
||||||
spriteRenderer.sortingOrder = -5;
|
spriteRenderer.sortingOrder = -5;
|
||||||
|
|
||||||
@@ -438,6 +447,7 @@ public class CustomGamePlayer : MonoBehaviour
|
|||||||
GameObject[] speedyBerries = GameObject.FindGameObjectsWithTag("SpeedyBerry");
|
GameObject[] speedyBerries = GameObject.FindGameObjectsWithTag("SpeedyBerry");
|
||||||
GameObject[] randomBerries = GameObject.FindGameObjectsWithTag("RandomBerry");
|
GameObject[] randomBerries = GameObject.FindGameObjectsWithTag("RandomBerry");
|
||||||
GameObject[] antiBerries = GameObject.FindGameObjectsWithTag("AntiBerry");
|
GameObject[] antiBerries = GameObject.FindGameObjectsWithTag("AntiBerry");
|
||||||
|
GameObject[] nothingBerries = GameObject.FindGameObjectsWithTag("NothingBerry");
|
||||||
|
|
||||||
if (!pausePanel.activeSelf)
|
if (!pausePanel.activeSelf)
|
||||||
{
|
{
|
||||||
@@ -587,6 +597,25 @@ public class CustomGamePlayer : MonoBehaviour
|
|||||||
antiBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
antiBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
foreach (GameObject nothingBerry in nothingBerries)
|
||||||
|
{
|
||||||
|
if (nothingBerry.transform.position.y < 0f - Camera.main.orthographicSize - 1f)
|
||||||
|
{
|
||||||
|
Destroy(nothingBerry);
|
||||||
|
}
|
||||||
|
else if (UnityEngine.Vector3.Distance(bird.transform.position, nothingBerry.transform.position) < 1.5f)
|
||||||
|
{
|
||||||
|
DoNothingBerry(nothingBerry);
|
||||||
|
}
|
||||||
|
if (speedyLeft > 0)
|
||||||
|
{
|
||||||
|
nothingBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -7.5f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nothingBerry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, -4f);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -599,6 +628,7 @@ public class CustomGamePlayer : MonoBehaviour
|
|||||||
.Concat(speedyBerries)
|
.Concat(speedyBerries)
|
||||||
.Concat(randomBerries)
|
.Concat(randomBerries)
|
||||||
.Concat(antiBerries)
|
.Concat(antiBerries)
|
||||||
|
.Concat(nothingBerries)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
foreach (GameObject berry in allberries)
|
foreach (GameObject berry in allberries)
|
||||||
{
|
{
|
||||||
@@ -628,6 +658,7 @@ public class CustomGamePlayer : MonoBehaviour
|
|||||||
.Concat(GameObject.FindGameObjectsWithTag("SpeedyBerry"))
|
.Concat(GameObject.FindGameObjectsWithTag("SpeedyBerry"))
|
||||||
.Concat(GameObject.FindGameObjectsWithTag("RandomBerry"))
|
.Concat(GameObject.FindGameObjectsWithTag("RandomBerry"))
|
||||||
.Concat(GameObject.FindGameObjectsWithTag("AntiBerry"))
|
.Concat(GameObject.FindGameObjectsWithTag("AntiBerry"))
|
||||||
|
.Concat(GameObject.FindGameObjectsWithTag("NothingBerry"))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
foreach (GameObject berry in allberries)
|
foreach (GameObject berry in allberries)
|
||||||
{
|
{
|
||||||
@@ -764,4 +795,10 @@ public class CustomGamePlayer : MonoBehaviour
|
|||||||
antiLeft = 10f;
|
antiLeft = 10f;
|
||||||
UpdateStats(0, 0);
|
UpdateStats(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DoNothingBerry(GameObject berry)
|
||||||
|
{
|
||||||
|
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Eat"), Camera.main.transform.position, 1.2f * BazookaManager.Instance.GetSettingSFXVolume());
|
||||||
|
Destroy(berry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,7 @@ public class CustomGameTempData : MonoBehaviour
|
|||||||
public float speedyBerryChance;
|
public float speedyBerryChance;
|
||||||
public float randomBerryChance;
|
public float randomBerryChance;
|
||||||
public float antiBerryChance;
|
public float antiBerryChance;
|
||||||
|
public float nothingBerryChance;
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
public class PlayMenu : MonoBehaviour
|
public class PlayMenu : MonoBehaviour
|
||||||
{
|
{
|
||||||
private static WaitForSeconds _waitForSeconds7 = new WaitForSeconds(7);
|
private static WaitForSeconds _waitForSeconds7 = new(7);
|
||||||
private static WaitForSeconds _waitForSeconds3 = new WaitForSeconds(3);
|
private static WaitForSeconds _waitForSeconds3 = new(3);
|
||||||
public GameObject selectionMenu;
|
public GameObject selectionMenu;
|
||||||
public GameObject customMenu;
|
public GameObject customMenu;
|
||||||
public Button customButton;
|
public Button customButton;
|
||||||
@@ -22,6 +22,7 @@ public class PlayMenu : MonoBehaviour
|
|||||||
public TMP_InputField speedyBerryChance;
|
public TMP_InputField speedyBerryChance;
|
||||||
public TMP_InputField randomBerryChance;
|
public TMP_InputField randomBerryChance;
|
||||||
public TMP_InputField antiBerryChance;
|
public TMP_InputField antiBerryChance;
|
||||||
|
public TMP_InputField nothingBerryChance;
|
||||||
|
|
||||||
public TMP_Text validateTotalText;
|
public TMP_Text validateTotalText;
|
||||||
|
|
||||||
@@ -48,6 +49,7 @@ public class PlayMenu : MonoBehaviour
|
|||||||
speedyBerryChance.text = "10%";
|
speedyBerryChance.text = "10%";
|
||||||
randomBerryChance.text = "5%";
|
randomBerryChance.text = "5%";
|
||||||
antiBerryChance.text = "5%";
|
antiBerryChance.text = "5%";
|
||||||
|
nothingBerryChance.text = "0%";
|
||||||
ValidateTotal();
|
ValidateTotal();
|
||||||
});
|
});
|
||||||
customPlayButton.onClick.AddListener(async () =>
|
customPlayButton.onClick.AddListener(async () =>
|
||||||
@@ -62,6 +64,7 @@ public class PlayMenu : MonoBehaviour
|
|||||||
customGameTempData.speedyBerryChance = float.Parse(speedyBerryChance.text.Replace("%", "").Trim());
|
customGameTempData.speedyBerryChance = float.Parse(speedyBerryChance.text.Replace("%", "").Trim());
|
||||||
customGameTempData.randomBerryChance = float.Parse(randomBerryChance.text.Replace("%", "").Trim());
|
customGameTempData.randomBerryChance = float.Parse(randomBerryChance.text.Replace("%", "").Trim());
|
||||||
customGameTempData.antiBerryChance = float.Parse(antiBerryChance.text.Replace("%", "").Trim());
|
customGameTempData.antiBerryChance = float.Parse(antiBerryChance.text.Replace("%", "").Trim());
|
||||||
|
customGameTempData.nothingBerryChance = float.Parse(nothingBerryChance.text.Replace("%", "").Trim());
|
||||||
await SceneManager.LoadSceneAsync("CustomGamePlayer");
|
await SceneManager.LoadSceneAsync("CustomGamePlayer");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -190,6 +193,24 @@ public class PlayMenu : MonoBehaviour
|
|||||||
customBackButton.interactable = true;
|
customBackButton.interactable = true;
|
||||||
ValidateTotal();
|
ValidateTotal();
|
||||||
});
|
});
|
||||||
|
nothingBerryChance.onSelect.AddListener((value) =>
|
||||||
|
{
|
||||||
|
validateTotalText.gameObject.SetActive(false);
|
||||||
|
customBackButton.interactable = false;
|
||||||
|
customPlayButton.interactable = false;
|
||||||
|
nothingBerryChance.text = value.Replace("%", "");
|
||||||
|
nothingBerryChance.stringPosition = nothingBerryChance.text.Length;
|
||||||
|
});
|
||||||
|
nothingBerryChance.onDeselect.AddListener((value) =>
|
||||||
|
{
|
||||||
|
if (float.TryParse(value, out var value2) && value2 < 0f)
|
||||||
|
{
|
||||||
|
value = "0";
|
||||||
|
}
|
||||||
|
nothingBerryChance.text = value + "%";
|
||||||
|
customBackButton.interactable = true;
|
||||||
|
ValidateTotal();
|
||||||
|
});
|
||||||
jumpscareButton.onClick.AddListener(() =>
|
jumpscareButton.onClick.AddListener(() =>
|
||||||
{
|
{
|
||||||
jumpscareButton.GetComponent<Image>().color = Color.red;
|
jumpscareButton.GetComponent<Image>().color = Color.red;
|
||||||
@@ -211,6 +232,7 @@ public class PlayMenu : MonoBehaviour
|
|||||||
total += float.Parse(speedyBerryChance.text.Replace("%", ""));
|
total += float.Parse(speedyBerryChance.text.Replace("%", ""));
|
||||||
total += float.Parse(randomBerryChance.text.Replace("%", ""));
|
total += float.Parse(randomBerryChance.text.Replace("%", ""));
|
||||||
total += float.Parse(antiBerryChance.text.Replace("%", ""));
|
total += float.Parse(antiBerryChance.text.Replace("%", ""));
|
||||||
|
total += float.Parse(nothingBerryChance.text.Replace("%", ""));
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ TagManager:
|
|||||||
- CoinBerry
|
- CoinBerry
|
||||||
- RandomBerry
|
- RandomBerry
|
||||||
- AntiBerry
|
- AntiBerry
|
||||||
|
- NothingBerry
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
|
|||||||
Reference in New Issue
Block a user