커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
게임오버시에 현재 시간과 판넬에 뜨는 시간이 다릅니다.
undefined주차
북마크
임*윤
댓글
9
추천
0
조회수
7
조회수
7
답변 완료

자료에 있는 내용대로 작성을 해봤는데도

똑같이 안되고 있습니다.






스파르타 즉문즉답




using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;


public class gameManager : MonoBehaviour
{
    public GameObject square;
    public Text timeTxt;
    public Text thisscoreTxt;
    float alive = 0f;
    bool isRunning = true;
    public static gameManager I;
    public GameObject endPanel;


    void Awake()
    {
        I = this;
    }
    void Start()
    {
        InvokeRepeating("makeSquare", 0.0f, 0.7f);
    }
    // Update is called once per frame
    void Update()
    {
        if (isRunning)
        {
            alive += Time.deltaTime;
            timeTxt.text = alive.ToString("N2");
        }
        
    }
    void makeSquare()
    {
        Instantiate(square);
    }


    public void gameOver()
    {
        isRunning = false;
        Time.timeScale = 0f;
        endPanel.SetActive(true);
        thisscoreTxt.text = alive.ToString("N2");
        endPanel.SetActive(true);
    }
}




취소
 공유
취소
댓글 0
댓글 알림
나의얼굴