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
Refactor: Mission Class #88
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
질문 있슴니다.........
변수명 앞에 붙은 _ 이런 표시는 클래스 내에서 전역적으로 쓰일 때 붙여야 하는거야?
전역변수 private 으로 선언될 때 쓰는 규칙인가요...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
카멜표기법이라고 부르는데 간단하게 멤버 private은 _로 구분하고 public, protected는 붙이지 않는 것
정리 잘된 블로그 글이라 이거 보며 조금 이해될거야
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
헐 고마워...! 당장 읽어볼게