Game Development Community

Possible to have multipe onEnter Trigger delegates [Solved]

by Raymond Ku · in Torque X 2D · 03/16/2010 (2:48 pm) · 2 replies

I created two blank sceneobjects in my txscene(endlevel, and SpawnEnemyWaves)

I attached a different component to each sceneobject.
Both components pretty much just contain a T2DTriggerComponentOnEnterDelegate.

endlevel object was the first object i created and it works correctly as in the OnEnterdelegate
will show up in TXB rollout in the Trigger component.

however now that i'm trying to add a similar object to spawn enemies.
The onenterDelegate function will not show up in TXB rollout for the component.

[TorqueXmlSchemaType] 
        public T2DTriggerComponentOnLeaveDelegate GenerateWave
        {
            get { return GenWave; }
        }

public void GenWave(T2DSceneObject ourobject, T2DSceneObject theirobject)
        {
            if (!Triggered)
            {
                Game.Instance.SpawnZombieWave(NumZombies, MinY, MaxY);
                Triggered = true;
            }
        }

The only difference i can tell is that the trigger delegate in the enemy wave generation component is not static, becuase i'm trying to make sure that it only gets triggered once.

the end level trigger is static and it works fine.

Is it even possible to have two TriggerDelegates?
or do the trigger delegates have to be static?




#1
03/16/2010 (3:13 pm)
Turns out making both functions

public static T2DTriggerComponentOnLeaveDelegate GenerateWave
public static void GenWave(T2DSceneObject ourobject, T2DSceneObject theirobject)

brought the onEnter function up in the TXB rollout

But this ends up with a problem where upon multiple entries waves will constantly generate.

#2
03/16/2010 (3:29 pm)
Okay i made another delegate for Onleave to delete the blank object so it doesnt trigger again.

Just posting for anyone in the future who might stumble across similar issues. =)