-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.cs
59 lines (48 loc) · 900 Bytes
/
Player.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
using UnityEngine;
using System.Collections;
/*
* File Name : Player.cs
* Author : Austin Khamsisavadty 100942529
* Last Modified : 10/30/2016
* Date Last Modified : 10/30/2016
* Description : player class
* Revision : 1.0
* */
public class Player {
private int _points = 0;
private int _health = 5;
public HUDController hud;
private static Player _instance = null;
public static Player Instance{
get{
if (_instance == null) {
_instance = new Player ();
}
return _instance;
}
}
private Player(){
}
public int Points{
get{
return _points;
}
set{
_points = value;
hud.UpdatePoints();
}
}
public int Health{
get{
return _health;
}
set{
_health = value;
hud.UpdateHealth();
if (_health <= 0)
{
hud.GameOver();
}
}
}
}