Untitled
unknown
csharp
2 years ago
827 B
5
Indexable
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameManager : MonoBehaviour
{
public static GameManager Instance;
[SerializeField]
private int playsc = 0;
[SerializeField]
private GameObject pref;
// Start is called before the first frame update
void Start()
{
Instance = this;
SetBall(BallColor.White);
SetBall(BallColor.Red);
SetBall(BallColor.Yellow);
}
public void UpdateScore(int n)
{
playsc += n;
}
// Update is called once per frame
private void SetBall(BallColor cl)
{
GameObject obj = Instantiate(pref, Vector3.zero, Quaternion.identity);
ball b = obj.GetComponent<ball>();
b.SetColorAndPoint(cl);
}
}
Editor is loading...