Coin Berry stuff

This commit is contained in:
2025-07-29 21:12:21 -07:00
parent 7d0bad955b
commit 99e4efcaf3
3 changed files with 172 additions and 9 deletions

View File

@@ -802,6 +802,7 @@ MonoBehaviour:
scoreText: {fileID: 432923591}
highScoreText: {fileID: 1606868532}
boostText: {fileID: 497996347}
coinsText: {fileID: 1527994350}
editingUI: 0
--- !u!1 &432923589
GameObject:
@@ -1224,9 +1225,9 @@ RectTransform:
- {fileID: 211523164}
m_Father: {fileID: 302151017}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 97.5, y: 47.5}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -97.5, y: 132.5}
m_SizeDelta: {x: 175, y: 75}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &477875207
@@ -1628,18 +1629,13 @@ MonoBehaviour:
scoreText: {fileID: 432923591}
highScoreText: {fileID: 1606868532}
boostText: {fileID: 497996347}
coinText: {fileID: 1527994350}
bird: {fileID: 808236448}
pausePanel: {fileID: 302151016}
rb: {fileID: 808236449}
backgroundMusic: {fileID: 1625416039}
fpsCounter: {fileID: 83812371}
overlayRender: {fileID: 450099081}
leftArrow: {fileID: 0}
rightArrow: {fileID: 0}
jumpArrow: {fileID: 0}
restartButton: {fileID: 0}
backButton: {fileID: 0}
lastMoveTime: 0
berryParent: {fileID: 157908646}
--- !u!1 &527090675
GameObject:
@@ -2774,6 +2770,157 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -20, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1527994348
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1527994349}
- component: {fileID: 1527994351}
- component: {fileID: 1527994350}
- component: {fileID: 1527994352}
m_Layer: 5
m_Name: CoinsText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1527994349
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1527994348}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1811565639}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 260, y: 47.5}
m_SizeDelta: {x: 500, y: 75}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1527994350
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1527994348}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: 'Coins: 0'
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 4fd546dd0900395408d2de20f5025882, type: 2}
m_sharedMaterial: {fileID: -1476194838487357290, guid: 4fd546dd0900395408d2de20f5025882, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 36
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 1024
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_TextWrappingMode: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 0
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_EmojiFallbackSupport: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &1527994351
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1527994348}
m_CullTransparentMesh: 1
--- !u!114 &1527994352
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1527994348}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8e4353c3e16b539839e7f8d301ca5e38, type: 3}
m_Name:
m_EditorClassIdentifier:
uiName: CoinsText
canDrag: 0
--- !u!1 &1539199159
GameObject:
m_ObjectHideFlags: 0
@@ -3499,6 +3646,7 @@ RectTransform:
- {fileID: 432923590}
- {fileID: 1606868531}
- {fileID: 497996346}
- {fileID: 1527994349}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}

View File

@@ -19,6 +19,7 @@ public class GamePlayer : MonoBehaviour
private BigInteger totalSpeedyBerries;
private BigInteger totalCoinBerries;
private BigInteger totalAttempts;
private BigInteger totalCoins;
private float boostLeft;
private float slownessLeft;
private float speedyLeft;
@@ -27,6 +28,7 @@ public class GamePlayer : MonoBehaviour
public TMP_Text scoreText;
public TMP_Text highScoreText;
public TMP_Text boostText;
public TMP_Text coinText;
public GameObject bird;
public GameObject pausePanel;
public Rigidbody2D rb;
@@ -82,6 +84,7 @@ public class GamePlayer : MonoBehaviour
totalSpeedyBerries = BazookaManager.Instance.GetGameStoreTotalSpeedyBerries();
totalCoinBerries = BazookaManager.Instance.GetGameStoreTotalCoinBerries();
totalAttempts = BazookaManager.Instance.GetGameStoreTotalAttepts();
totalCoins = BazookaManager.Instance.GetCustomBirdIconData().Balance;
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;
@@ -574,7 +577,11 @@ public class GamePlayer : MonoBehaviour
}
else if (UnityEngine.Vector3.Distance(bird.transform.position, coinBerry.transform.position) < 1.5f)
{
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/CoinCollect"), Camera.main.transform.position, 0.35f * BazookaManager.Instance.GetSettingSFXVolume());
Destroy(coinBerry);
totalCoinBerries++;
totalCoins++;
UpdateStats(0, 0);
}
if (speedyLeft > 0)
{
@@ -650,8 +657,12 @@ public class GamePlayer : MonoBehaviour
BazookaManager.Instance.SetGameStoreTotalSpeedyBerries(totalSpeedyBerries);
BazookaManager.Instance.SetGameStoreTotalCoinBerries(totalCoinBerries);
BazookaManager.Instance.SetGameStoreTotalAttepts(totalAttempts);
var customBirdIconData = BazookaManager.Instance.GetCustomBirdIconData();
customBirdIconData.Balance = totalCoins;
BazookaManager.Instance.SetCustomBirdIconData(customBirdIconData);
scoreText.text = $"Score: {Tools.FormatWithCommas(score)} \\u2022 Attempts: {Tools.FormatWithCommas(attempts)}";
highScoreText.text = $"High Score: {Tools.FormatWithCommas(highscore)} \\u2022 Total Attempts: {Tools.FormatWithCommas(totalAttempts)}";
coinText.text = $"Coins: {Tools.FormatWithCommas(totalCoins)}";
if (restartButton != null) restartButton.GetComponent<Renderer>().material.color = score == 0 ? Color.gray : Color.white;
}

View File

@@ -16,6 +16,7 @@ public class GamePlayerPauseMenu : MonoBehaviour
public TMP_Text scoreText;
public TMP_Text highScoreText;
public TMP_Text boostText;
public TMP_Text coinsText;
public bool editingUI = false;
void Awake()
@@ -47,10 +48,12 @@ public class GamePlayerPauseMenu : MonoBehaviour
((RectTransform)scoreText.transform).anchoredPosition = new Vector2(0f, -70f);
((RectTransform)highScoreText.transform).anchoredPosition = new Vector2(0f, -140f);
((RectTransform)boostText.transform).anchoredPosition = new Vector2(0f, -190f);
((RectTransform)coinsText.transform).anchoredPosition = new Vector2(260f, 47.5f);
PlayerPrefs.DeleteKey("DraggedUIFPSText");
PlayerPrefs.DeleteKey("DraggedUIScoreText");
PlayerPrefs.DeleteKey("DraggedUIHighScoreText");
PlayerPrefs.DeleteKey("DraggedUIBoostText");
PlayerPrefs.DeleteKey("DraggedUICoinsText");
});
}
@@ -67,5 +70,6 @@ public class GamePlayerPauseMenu : MonoBehaviour
scoreText.GetComponent<DraggableUI>().canDrag = !scoreText.GetComponent<DraggableUI>().canDrag;
highScoreText.GetComponent<DraggableUI>().canDrag = !highScoreText.GetComponent<DraggableUI>().canDrag;
boostText.GetComponent<DraggableUI>().canDrag = !boostText.GetComponent<DraggableUI>().canDrag;
coinsText.GetComponent<DraggableUI>().canDrag = !coinsText.GetComponent<DraggableUI>().canDrag;
}
}