-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentity.php
More file actions
61 lines (49 loc) · 989 Bytes
/
entity.php
File metadata and controls
61 lines (49 loc) · 989 Bytes
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
<?php
/**
*
*/
abstract class Entity {
private $guid;
private $soul = array();
protected $MODE;
const WORKING = 1;
const IDLE = 0;
function __construct($space, $type, $group = null, $name = null) {
$this->space = $space;
$this->type = $type;
$this->group = $group;
$this->name = $name;
$this->MODE = Entity::WORKING;
}
public function getGuid() {
return $this->guid;
}
public function setGuid($guid) {
$this->guid = $guid;
}
public function wake() {
$this->MODE = Entity::WORKING;
}
public function sleep() {
$this->MODE = Entity::IDLE;
}
public function __get($name){
if (isset($this->$name)) {
return $this->soul[$name];
} else {
return null;
}
}
public function __set($name, $value){
$this->soul[$name] = $value;
}
public function __isset($name){
if (isset($this->soul[$name])) {
return true;
} else {
return false;
}
}
abstract public function work();
}
?>