Merge pull request #19 from EliasFleckenstein03/main
Properly set cheese counter display on respawn
This commit is contained in:
commit
043a621b6c
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@ -16,7 +16,7 @@ public class Dialogue : MonoBehaviour
|
||||
public Text dialogueText;
|
||||
|
||||
public string[] sentences;
|
||||
|
||||
|
||||
[HideInInspector]
|
||||
public int index;
|
||||
|
||||
@ -90,4 +90,4 @@ public class Dialogue : MonoBehaviour
|
||||
mouse.GetComponent<MouseController>().enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class CheckpointManager : MonoBehaviour
|
||||
{
|
||||
PlayerData data = SaveSystem.LoadPlayer();
|
||||
|
||||
cheese.cheesecount = data.collectedCheese;
|
||||
cheese.SetCheeseCount(data.collectedCheese);
|
||||
cheeseCoin.cheeseCoinCollected = data.isCheeseCoinCollected;
|
||||
|
||||
Vector3 position;
|
||||
|
@ -6,7 +6,7 @@ using UnityEngine.UI;
|
||||
public class Cheese : MonoBehaviour
|
||||
{
|
||||
public Text countText;
|
||||
|
||||
|
||||
[HideInInspector]
|
||||
public int cheesecount;
|
||||
|
||||
@ -14,16 +14,14 @@ public class Cheese : MonoBehaviour
|
||||
|
||||
void Start()
|
||||
{
|
||||
countText.text = cheesecount.ToString();
|
||||
SetCheeseCount(0);
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
if (collision.gameObject.CompareTag("Cheese"))
|
||||
{
|
||||
cheesecount++;
|
||||
|
||||
SetCountText();
|
||||
SetCheeseCount(cheesecount + 1);
|
||||
|
||||
FindObjectOfType<AudioManager>().Play("cheese_plop");
|
||||
|
||||
@ -31,8 +29,9 @@ public class Cheese : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCountText()
|
||||
public void SetCheeseCount(int count)
|
||||
{
|
||||
countText.text = cheesecount.ToString();
|
||||
}
|
||||
cheesecount = count;
|
||||
countText.text = cheesecount.ToString();
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class MousePos : MonoBehaviour
|
||||
health = GetComponent<Health>();
|
||||
cheese = GetComponent<Cheese>();
|
||||
transform.position = checkpointManager.lastCheckpointPos;
|
||||
cheese.cheesecount = checkpointManager.lastCheeseCount;
|
||||
cheese.SetCheeseCount(checkpointManager.lastCheeseCount);
|
||||
}
|
||||
|
||||
void Update()
|
||||
|
@ -21,17 +21,17 @@ EditorUserSettings:
|
||||
value: 22424703114646680e0b0227036c17415f573f38292d280f042d043feeaf332ae7e238d6ee3e2630353db7721130082beb
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-5:
|
||||
value: 22424703114646680e0b0227036c17415f573f38292d280f042d043feeaf332ae7e238d6ee3e2630353dbe6c4a2b0f36e613
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-6:
|
||||
value: 22424703114646680e0b0227036c5315001214153f2d2a352e3d143cecae2136ebf32f
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-7:
|
||||
RecentlyUsedScenePath-6:
|
||||
value: 22424703114646680e0b0227036c5315001214152926227e38271427fb
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-8:
|
||||
RecentlyUsedScenePath-7:
|
||||
value: 22424703114646680e0b0227036c6c0417050c192f3a23352367083debf42d
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-8:
|
||||
value: 22424703114646680e0b0227036c17415f573f38292d280f042d043feeaf332ae7e238d6ee3e2630353dbe6c4a2b0f36e613
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-9:
|
||||
value: 22424703114646680e0b0227036c17415f573f38292d280f042d043feeaf332ae7e238d6ee3e2630353dbe721130082beb
|
||||
flags: 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user