Untitled

mail@pastecode.io avatar
unknown
csharp
7 months ago
827 B
0
Indexable
Never
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);
    }

}