-
Notifications
You must be signed in to change notification settings - Fork 0
/
Camera.cs
78 lines (72 loc) · 1.42 KB
/
Camera.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
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
using System;
using System.Text;
namespace GameEngine
{
public class Camera
{
private static Camera camera;
int width, height;
StringBuilder builder = new StringBuilder();
public static Camera main
{
get
{
if (camera == null)
{
camera = new Camera();
}
return camera;
}
}
public Camera()
{
width = 20;
height = 20;
}
private string buffer;
public void Render()
{
WriteLine("AUTOR : LUIS FERNANDO GOMES SOARES");
WriteLine("");
WriteLine(" INSTRUÇÕES DE JOGAR");
WriteLine("[UP] MOVE PARA CIMA");
WriteLine("[DOWN] MOVE PARA BAIXO");
WriteLine("[LEFT] MOVE PARA ESQUERDO");
WriteLine("[RIGHT] MOVE PARA DIREITO");
WriteLine("");
for (int y = 0; y < height; y = y + 1)
{
for (int x = 0; x < width; x = x + 1)
{
Vector2 p = new Vector2(x, y);
if (GameObject.Exists(p))
{
GameObject o = GameObject.Find(p);
Renderer render = o.renderer;
if (render != null)
{
buffer += render.rend;
}
else
{
buffer += ' ';
}
}
else
{
buffer += ' ';
}
}
WriteLine(buffer);
buffer = "";
}
Console.Clear();
Console.Write(builder);
builder.Clear();
}
private void WriteLine(string buffer)
{
builder.AppendLine(buffer);
}
}
}