-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patht3.cs
More file actions
102 lines (91 loc) · 2 KB
/
t3.cs
File metadata and controls
102 lines (91 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 실습3
{
public class Parent
{
public void Method01()
{
Debug.Log("Parent");
}
}
public class Child : Parent
{
public new void Method01()
{
Debug.Log("Child");
}
}
public class GameController : MonoBehaviour
{
private void Awake()
{
Parent p = new Parent();
p.Method01();
Child c = new Child();
c.Method01();
Parent pc = new Child();
pc.Method01();
}
}
public class Tuple
{
private void Awake()
{
var a = ("고박사", 35);
Debug.Log($"{a.Item1}, {a.Item2}");
a.Item2 = 36;
Debug.Log($"{a.Item1}, {a.Item2}");
}
}
public class Enemy2
{
public int InstanceRun() { return 1; }
public static int StaticRun()
{
return 1;
}
}
public class GameController2 : MonoBehaviour
{
private void Awake2()
{
int j = Enemy.StaticRun();
Enemy enemy01 = new Enemy();
int i = enemy01.InstanceRun();
}
}
}
namespace 실습3
{
public class Player
{
private int currentHP;
public int CurrentHP
{
get => currentHP;
set
{
if (value > 0)
currentHP = value;
else
currentHP = 0;
}
}
}
public class GameController : MonoBehaviour
{
private void Awake()
{
Player player = new Player();
player.CurrentHP = 100;
Debug.Log($"Player HP : {player.CurrentHP}");
player.CurrentHP = -100;
Debug.Log($"Player HP : {player.CurrentHP}");
}
}
}