This repository has been archived by the owner on Aug 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from The-Day-In-1984/feature/MissonSystem
Refactor: Mission Class
- Loading branch information
Showing
15 changed files
with
162 additions
and
192 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
1984/Assets/Scripts/Runtime/UI/Mission/Function/CountLogic.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
|
||
public class CountLogic | ||
{ | ||
public Action OnCountChanged; | ||
public Action OnCountMax; | ||
|
||
private float _count; | ||
private readonly float _maxCount; | ||
|
||
public CountLogic(float maxCount, float count = 0) | ||
{ | ||
_maxCount = maxCount; | ||
_count = count; | ||
} | ||
|
||
public void AddCount(int count) | ||
{ | ||
_count += count; | ||
OnCountChanged?.Invoke(); | ||
|
||
if (_count >= _maxCount) | ||
{ | ||
OnCountMax?.Invoke(); | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
1984/Assets/Scripts/Runtime/UI/Mission/Function/CountLogic.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.