-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRat.as
60 lines (51 loc) · 1.13 KB
/
Rat.as
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
package
{
import com.as3dp.puremvc.movethecheese.actors.rat.RatFacade;
import com.as3dp.puremvc.movethecheese.interfaces.IActor;
import com.as3dp.puremvc.movethecheese.interfaces.IApplicationShell;
import flash.display.Sprite;
import flash.geom.Point;
import mx.utils.UIDUtil;
[SWF(frameRate="50", backgroundColor="0xFFFFFF")]
public class Rat extends Sprite implements IActor
{
private var shell:IApplicationShell;
/**
* Get unique identifier for this puremvc core
*/
private function get key():String
{
return 'Rat-' + UIDUtil.getUID(this);
}
public function setApplicationShell(shell:IApplicationShell):void
{
this.shell = shell;
}
public function init():void
{
if ( shell )
{
RatFacade.getInstance( this.key ).startup( this );
}
else
{
throw Error("Set application shell before calling init");
}
}
public function update():void
{
RatFacade.getInstance( this.key ).update();
}
public function get cheeseLoc():Point
{
if ( shell )
{
return shell.cheeseLoc;
}
else
{
throw Error('Application shell not set');
}
}
}
}