-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameManager.cs
More file actions
37 lines (31 loc) · 893 Bytes
/
GameManager.cs
File metadata and controls
37 lines (31 loc) · 893 Bytes
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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class GameManager : MonoBehaviour {
private Ball ball;
private PinSetter pinSetter;
private ScoreDisplay scoreDisplay;
private List<int> bowls = new List<int>();
// Use this for initialization
void Start () {
ball = GameObject.FindObjectOfType<Ball>();
pinSetter = GameObject.FindObjectOfType<PinSetter>();
scoreDisplay = GameObject.FindObjectOfType<ScoreDisplay>();
}
public void Bowl(int pinFall){
try{
bowls.Add(pinFall);
pinSetter.AnimateAction(ActionMaster.NextAction(bowls));
} catch {
Debug.LogWarning("Bowls() has an error!");
}
try{
scoreDisplay.FillBowls(bowls);
scoreDisplay.FillFrames(ScoreMaster.ScoreCumulative(bowls));
} catch {
Debug.LogWarning("scoreDisplay.FillRollCard() has an error!");
}
ball.Reset();
}
}