forked from sfc-sdp/GameCanvas-Unity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game.cs
48 lines (42 loc) · 1.18 KB
/
Game.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
using Sequence = System.Collections.IEnumerator;
/// <summary>
/// ゲームクラス。
/// 学生が編集すべきソースコードです。
/// </summary>
public sealed class Game : GameBase
{
// 変数の宣言
int sec = 0;
/// <summary>
/// 初期化処理
/// </summary>
public override void InitGame()
{
// キャンバスの大きさを設定します
gc.SetResolution(720, 1280);
}
/// <summary>
/// 動きなどの更新処理
/// </summary>
public override void UpdateGame()
{
// 起動からの経過時間を取得します
sec = (int)gc.TimeSinceStartup;
}
/// <summary>
/// 描画の処理
/// </summary>
public override void DrawGame()
{
// 画面を白で塗りつぶします
gc.ClearScreen();
// 0番の画像を描画します
gc.DrawImage(0, 0, 0);
// 黒の文字を描画します
gc.SetColor(0, 0, 0);
gc.SetFontSize(48);
gc.DrawString("この文字と青空の画像が", 40, 160);
gc.DrawString("見えていれば成功です", 40, 270);
gc.DrawRightString($"{sec}s", 630, 10);
}
}