12일차 클래스 2차원 위치정보
Console Programming/C# Console 2019. 10. 8. 08:47
|
Program.cs
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace StarCraft
{
class Program
{
static void Main(string[] args)
{
new App();
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
|
App.cs
|
|
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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace StarCraft
{
public class App
{
public App()
{
Unit headQuarter1 = new Unit("해처리", new Position(0,-2));
var unit1 = new Unit("드론1", new Position(-1, 4));
var unit2 = new Unit("드론2", new Position(1, -4));
var unit3 = new Unit("드론3", new Position(2, -4));
var unit4 = new Unit("드론4", new Position(0, 4));
var unit5 = new Unit("오버로드", new Position(3, -5));
var unit6 = new Unit("라바1", new Position(-1, 4));
var unit7 = new Unit("라바2", new Position(1, -4));
var unit8 = new Unit("라바3", new Position(0, -4));
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
|
Building.cs
|
|
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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace StarCraft
{
public class Building
{
//data
//name
//position
public string name;
public Position position;
public Building(string name, Position position)
{
this.position = position;
this.name = name;
}
//function
//SelectLarva
public void SelectLarva()
{
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
|
Unit.cs
|
|
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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace StarCraft
{
public class Unit
{
//data
//name
//hp
//coordinate
public string name;
public int hp;
public int maxHp;
public Position position;
public Unit(string name, Position position)
{
this.position = position;
this.name = name;
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
|
Unit.cs
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace StarCraft
{
public class Position
{
//data
//coordinte
public int x;
public int y;
public Position(int x, int y)
{
this.x = x;
this.y = y;
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
![](https://blog.kakaocdn.net/dn/cpyFYK/btqyULJ5WPq/6OhHyQLcI6Q3vfMPdIb2s1/img.png)
'Console Programming > C# Console' 카테고리의 다른 글
12일차 클래스(3) (0) | 2019.10.08 |
---|---|
12일차 클래스(2) (0) | 2019.10.08 |
백준 2675 문자열 반복 (0) | 2019.10.08 |
백준 2675 문자열 반복 (0) | 2019.10.08 |
백준 11809 알파벳 찾기 (0) | 2019.10.08 |