|
@@ -68,7 +68,7 @@ Class Entity Extends DynamicObject Abstract
|
|
Return copy
|
|
Return copy
|
|
End
|
|
End
|
|
|
|
|
|
- #rem monkeydoc Sequence id.
|
|
|
|
|
|
+ #rem monkeydoc Sequence id
|
|
|
|
|
|
The sequence id is an integer that is incremented whenever the entity's matrix is modified.
|
|
The sequence id is an integer that is incremented whenever the entity's matrix is modified.
|
|
|
|
|
|
@@ -78,7 +78,7 @@ Class Entity Extends DynamicObject Abstract
|
|
Return _seq
|
|
Return _seq
|
|
End
|
|
End
|
|
|
|
|
|
- #rem monkeydoc Entity name.
|
|
|
|
|
|
+ #rem monkeydoc Name
|
|
#end
|
|
#end
|
|
[jsonify=1]
|
|
[jsonify=1]
|
|
Property Name:String()
|
|
Property Name:String()
|
|
@@ -90,7 +90,10 @@ Class Entity Extends DynamicObject Abstract
|
|
_name=name
|
|
_name=name
|
|
End
|
|
End
|
|
|
|
|
|
- #rem monkeydoc @hidden
|
|
|
|
|
|
+ #rem monkeydoc Scene
|
|
|
|
+
|
|
|
|
+ The scene the entity belongs to.
|
|
|
|
+
|
|
#end
|
|
#end
|
|
Property Scene:Scene()
|
|
Property Scene:Scene()
|
|
|
|
|
|
@@ -385,6 +388,17 @@ Class Entity Extends DynamicObject Abstract
|
|
#end
|
|
#end
|
|
Method Destroy()
|
|
Method Destroy()
|
|
|
|
|
|
|
|
+ If _scene.Updating
|
|
|
|
+ If _state<>State.Active Return
|
|
|
|
+ _state=State.Destroying
|
|
|
|
+ _scene.UpdateFinished+=Destroy
|
|
|
|
+ Return
|
|
|
|
+ End
|
|
|
|
+
|
|
|
|
+ If _state=State.Destroyed Return
|
|
|
|
+
|
|
|
|
+ _state=State.Destroyed
|
|
|
|
+
|
|
While Not _children.Empty
|
|
While Not _children.Empty
|
|
_children.Top.Destroy()
|
|
_children.Top.Destroy()
|
|
Wend
|
|
Wend
|
|
@@ -513,7 +527,7 @@ Class Entity Extends DynamicObject Abstract
|
|
|
|
|
|
'should really be different pass...ie: ALL entities should be copied before ANY components?
|
|
'should really be different pass...ie: ALL entities should be copied before ANY components?
|
|
For Local c:=Eachin _components
|
|
For Local c:=Eachin _components
|
|
- c.OnCopy( copy )
|
|
|
|
|
|
+ c.Copy( copy )
|
|
Next
|
|
Next
|
|
|
|
|
|
copy.Visible=Visible
|
|
copy.Visible=Visible
|
|
@@ -523,8 +537,6 @@ Class Entity Extends DynamicObject Abstract
|
|
Copied( copy )
|
|
Copied( copy )
|
|
End
|
|
End
|
|
|
|
|
|
- Internal
|
|
|
|
-
|
|
|
|
Method AddInstance()
|
|
Method AddInstance()
|
|
|
|
|
|
If _scene.Editing _scene.Jsonifier.AddInstance( Self,New Variant[]( _parent ) )
|
|
If _scene.Editing _scene.Jsonifier.AddInstance( Self,New Variant[]( _parent ) )
|
|
@@ -540,6 +552,8 @@ Class Entity Extends DynamicObject Abstract
|
|
If _scene.Editing _scene.Jsonifier.AddInstance( Self,args )
|
|
If _scene.Editing _scene.Jsonifier.AddInstance( Self,args )
|
|
End
|
|
End
|
|
|
|
|
|
|
|
+ Internal
|
|
|
|
+
|
|
Method AddComponent( c:Component )
|
|
Method AddComponent( c:Component )
|
|
|
|
|
|
Local type:=c.Type
|
|
Local type:=c.Type
|
|
@@ -564,52 +578,57 @@ Class Entity Extends DynamicObject Abstract
|
|
_components.Remove( c )
|
|
_components.Remove( c )
|
|
End
|
|
End
|
|
|
|
|
|
- 'bottom up
|
|
|
|
- Method BeginUpdate()
|
|
|
|
-
|
|
|
|
- For Local e:=Eachin _children
|
|
|
|
- e.BeginUpdate()
|
|
|
|
- Next
|
|
|
|
|
|
+ Method Start()
|
|
|
|
|
|
For Local c:=Eachin _components
|
|
For Local c:=Eachin _components
|
|
- c.OnBeginUpdate()
|
|
|
|
|
|
+ c.Start()
|
|
Next
|
|
Next
|
|
|
|
|
|
|
|
+ For Local e:=Eachin _children
|
|
|
|
+ e.Start()
|
|
|
|
+ End
|
|
End
|
|
End
|
|
|
|
|
|
- 'top down
|
|
|
|
- Method Start()
|
|
|
|
-
|
|
|
|
|
|
+ Method BeginUpdate()
|
|
|
|
+
|
|
For Local c:=Eachin _components
|
|
For Local c:=Eachin _components
|
|
- c.OnStart()
|
|
|
|
|
|
+ c.BeginUpdate()
|
|
Next
|
|
Next
|
|
-
|
|
|
|
|
|
+
|
|
For Local e:=Eachin _children
|
|
For Local e:=Eachin _children
|
|
- e.Start()
|
|
|
|
- End
|
|
|
|
|
|
+ e.BeginUpdate()
|
|
|
|
+ Next
|
|
End
|
|
End
|
|
|
|
|
|
Method Update( elapsed:Float )
|
|
Method Update( elapsed:Float )
|
|
|
|
|
|
For Local c:=Eachin _components
|
|
For Local c:=Eachin _components
|
|
- c.OnUpdate( elapsed )
|
|
|
|
|
|
+ c.Update( elapsed )
|
|
End
|
|
End
|
|
|
|
|
|
For Local e:=Eachin _children
|
|
For Local e:=Eachin _children
|
|
e.Update( elapsed )
|
|
e.Update( elapsed )
|
|
Next
|
|
Next
|
|
End
|
|
End
|
|
-
|
|
|
|
- Method Collide( body:RigidBody )
|
|
|
|
|
|
+
|
|
|
|
+ Method EndUpdate()
|
|
|
|
|
|
For Local c:=Eachin _components
|
|
For Local c:=Eachin _components
|
|
- c.OnCollide( body )
|
|
|
|
|
|
+ c.EndUpdate()
|
|
Next
|
|
Next
|
|
-
|
|
|
|
- Collided( body )
|
|
|
|
- End
|
|
|
|
|
|
|
|
|
|
+ For Local e:=Eachin _children
|
|
|
|
+ e.EndUpdate()
|
|
|
|
+ Next
|
|
|
|
+ End
|
|
|
|
+
|
|
Private
|
|
Private
|
|
|
|
+
|
|
|
|
+ Enum State
|
|
|
|
+ Active=1
|
|
|
|
+ Destroying=2
|
|
|
|
+ Destroyed=3
|
|
|
|
+ End
|
|
|
|
|
|
Enum Dirty
|
|
Enum Dirty
|
|
M=1
|
|
M=1
|
|
@@ -632,13 +651,15 @@ Private
|
|
Field _t:Vec3f=New Vec3f
|
|
Field _t:Vec3f=New Vec3f
|
|
Field _r:Mat3f=New Mat3f
|
|
Field _r:Mat3f=New Mat3f
|
|
Field _s:Vec3f=New Vec3f(1)
|
|
Field _s:Vec3f=New Vec3f(1)
|
|
- Field _seq:Int=1
|
|
|
|
|
|
|
|
Field _dirty:Dirty=Dirty.All
|
|
Field _dirty:Dirty=Dirty.All
|
|
Field _M:AffineMat4f
|
|
Field _M:AffineMat4f
|
|
Field _W:AffineMat4f
|
|
Field _W:AffineMat4f
|
|
Field _IW:AffineMat4f
|
|
Field _IW:AffineMat4f
|
|
|
|
|
|
|
|
+ Field _state:State=State.Active
|
|
|
|
+ Field _seq:Int=1
|
|
|
|
+
|
|
Method InvalidateWorld()
|
|
Method InvalidateWorld()
|
|
|
|
|
|
If _dirty & Dirty.W Return
|
|
If _dirty & Dirty.W Return
|
|
@@ -673,8 +694,7 @@ Private
|
|
OnShow()
|
|
OnShow()
|
|
|
|
|
|
For Local c:=Eachin _components
|
|
For Local c:=Eachin _components
|
|
-
|
|
|
|
- c.OnShow()
|
|
|
|
|
|
+ c.Show()
|
|
Next
|
|
Next
|
|
|
|
|
|
Else
|
|
Else
|
|
@@ -682,8 +702,7 @@ Private
|
|
OnHide()
|
|
OnHide()
|
|
|
|
|
|
For Local c:=Eachin _components
|
|
For Local c:=Eachin _components
|
|
-
|
|
|
|
- c.OnHide()
|
|
|
|
|
|
+ c.Hide()
|
|
Next
|
|
Next
|
|
Endif
|
|
Endif
|
|
|
|
|