-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasketScript.cs
More file actions
46 lines (39 loc) · 1.48 KB
/
BasketScript.cs
File metadata and controls
46 lines (39 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using Unity.VisualScripting;
using UnityEngine;
public class BasketScript : MonoBehaviour
{
private PyramidCricketManager pyramidCricketManager;
public Color highlightColor;
[SerializeField] private float offsetY = 0.5f;
[SerializeField] private float animDuration = 0.5f;
public enum BasketType
{
Wrong,
Right,
}
public BasketType basketType = BasketType.Wrong;
private void Start()
{
pyramidCricketManager = FindObjectOfType<PyramidCricketManager>();
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("Ball") && basketType == BasketType.Right && pyramidCricketManager.isBasketHit == false)
{
Debug.Log("Right Basket: Move on the next step");
pyramidCricketManager.stepsToWinCompleted++;
pyramidCricketManager.UpdateStepsRemainingUI();
pyramidCricketManager.isBasketHit = true;
UIManager.Instance.SideNotePopUp(pyramidCricketManager.sideNote, "Great job!");
if(pyramidCricketManager.stepsToWinCompleted == GameManager.Instance.currentCricketLevelData.stepsToWin)
{
pyramidCricketManager.Win();
}
}
else if (basketType == BasketType.Wrong)
{
Debug.Log("Wrong basket");
UIManager.Instance.SideNotePopUp(pyramidCricketManager.sideNote, "Wrong basket!");
}
}
}