You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
507 B
C#
21 lines
507 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace Class03
|
|
{
|
|
// 점수 데이터와 변경 알림만 관리합니다.
|
|
public sealed class ScoreCounter : MonoBehaviour
|
|
{
|
|
[SerializeField, Min(1)] private int targetScore = 8;
|
|
public int Score { get; private set; }
|
|
public int TargetScore => targetScore;
|
|
public event Action<int, int> Changed;
|
|
|
|
public void AddPoint()
|
|
{
|
|
Score++;
|
|
Changed?.Invoke(Score, targetScore);
|
|
}
|
|
}
|
|
}
|