More changes from master.
This commit is contained in:
parent
e0897b53e4
commit
5dea5ab4d6
21 changed files with 892 additions and 42 deletions
48
zscript/swwm_Polyobjects/PolyobjectEffector.zs
Normal file
48
zscript/swwm_Polyobjects/PolyobjectEffector.zs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
class swwm_PolyobjectEffector: Thinker abstract
|
||||
{
|
||||
// Base abstract class for Polyobject Effectors
|
||||
// Polyobject Effectors affect how a polyobject behaves.
|
||||
// Polyobject Effectors contain a pointer to the next Effector of a polyobject,
|
||||
// forming a circular linked list.
|
||||
// To add an effector to a polyobject, call AddEffector() on a PolyobjectHandle.
|
||||
// To remove an effector, simply call Destroy() on it.
|
||||
|
||||
swwm_PolyobjectHandle Polyobject;
|
||||
swwm_PolyobjectEffector Next;
|
||||
|
||||
// OnAdd() is called once after adding the effector to a PolyobjectHandle
|
||||
virtual void OnAdd()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// PolyTick() is called every tic by a PolyobjectHandle
|
||||
virtual void PolyTick()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
override void OnDestroy()
|
||||
{
|
||||
swwm_PolyobjectEffector e = Polyobject.EffectorList;
|
||||
if (e != NULL)
|
||||
{
|
||||
// Find previous effector
|
||||
while (e && e.Next != self)
|
||||
{
|
||||
e = e.Next;
|
||||
}
|
||||
|
||||
// Link previous effector to the next effector
|
||||
e.Next = Next;
|
||||
|
||||
// Check if this effector is the last one
|
||||
if (e == self)
|
||||
{
|
||||
// Polyobject has no other effectors, set EffectorList to NULL
|
||||
Polyobject.EffectorList = NULL;
|
||||
}
|
||||
}
|
||||
Super.OnDestroy();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue