KomastarDev

Untitled

May 29th, 2020
962
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.45 KB | None | 0 0
  1. //  축약한 코드
  2. public bool IsAlive { get => gameObject.activeSelf && Hp > 0; }
  3. //  약간 풀어쓴 코드
  4. public bool IsAlive
  5. {
  6.     get
  7.     {
  8.         return gameObject.activeSelf && Hp > 0;
  9.     }
  10. }
  11. //  더 풀어쓴 코드
  12. public bool IsAlive
  13. {
  14.     get
  15.     {
  16.         //  게임오브젝트가 활성화 되어있고 Hp가 0보다 클때 true 반환
  17.         if ((gameObject.activeSelf) && (Hp > 0))
  18.             return true;
  19.         //  그 외의 경우 false 반환
  20.         return false;
  21.     }
  22. }
Add Comment
Please, Sign In to add comment