|
Post by beowulfkaine on Sept 11, 2016 5:26:25 GMT
Hello! So N00b here. I am working with CGk and its really nice, I'm looking to have a popup menu appear once the level/waves are complete. Any recomendations on how I can do this? I'm working with a VR system in which the canvas floats in the air. I pretty much got all of the other stuff done, but I can't figure out how to get the listener made to respond to the event action?
|
|
|
Post by DarkTonic Dev on Sept 11, 2016 17:48:42 GMT
Custom Events? That's the name of a feature of Core GameKit that has nothing to do with "game over"...
Anyway, to do a listener for that you do this:
1) Make a subclass of LevelSettingsListener. 2) Override the method(s) you want to add behavior to, probably Win and check the others. 3) Put the Listener on the same game object that it's listening to, to auto hook it up. 4) If not same game object, you must drag the game object into the Listener field of the LevelSettings game object.
|
|
|
Post by beowulfkaine on Sept 11, 2016 23:54:25 GMT
So is this right?
}
/// <summary> /// This method gets called when a Global Wave begins, before anything has spawned. /// </summary> public virtual void WaveStarted(LevelWave levelWaveInfo) { GameObject.Find("Canvas").active = true; }
This is the section from within LevelSettingsListener.cs which I then put on the UI canvas. It doesn't seem to be working however as the menu doesn't appear when the level starts (I'm using level start because its easier than killing the enemies and waiting to see if it appears.
|
|
|
Post by DarkTonic Dev on Sept 12, 2016 0:14:37 GMT
Well is the code firing or not? Add in a Debug.Log("wave started") or something.
If not firing, then the Listener is not hooked up to anything (not listening) - (i.e. step 4 I listed above). Go find the Listener field in LevelSettings and drag in your listener in. Also, this script will not do anything if it's on a disabled game object, which it sounds like it is.
|
|
Is this right?
Guest
Posts: 0
|
Post by Is this right? on Sept 12, 2016 7:10:59 GMT
Well is the code firing or not? Add in a Debug.Log("wave started") or something. If not firing, then the Listener is not hooked up to anything (not listening) - (i.e. step 4 I listed above). Go find the Listener field in LevelSettings and drag in your listener in. Also, this script will not do anything if it's on a disabled game object, which it sounds like it is. Its definitely not firing, but do I have this setup correctly?
|
|
|
Post by DarkTonic Dev on Sept 12, 2016 16:25:09 GMT
It's indeed hooked up since the Listener field says "Test" and not "none". Your debug statements should show up that you are using. I can't really help to debug any more unless you send me a test project. You have added debug statements and looked at the Console window during runtime when the specified event happens?
|
|
|
Post by beowulfkaine on Sept 12, 2016 23:04:02 GMT
It's indeed hooked up since the Listener field says "Test" and not "none". Your debug statements should show up that you are using. I can't really help to debug any more unless you send me a test project. You have added debug statements and looked at the Console window during runtime when the specified event happens? Well after shotgunning a 40 of Robitussin and By The Power Of Greyskull, I was able to get it to work! I now know the steps to fire off and to receive on a gameobject. I'm still a little confused as to how I can make a menu appear after the level has been won, because that seems to not be working, any ideas? I basically have the menu object activated, using the test method with "wave started" I hide the game object and press play, but the canvas game object still does not appear.
|
|
|
Post by DarkTonic Dev on Sept 12, 2016 23:19:11 GMT
You're using the wrong method. For Level Won, override the method "LevelEnded". Then code it to do whatever you like (show a menu).
|
|
|
Post by beowulfkaine on Sept 13, 2016 16:51:12 GMT
You're using the wrong method. For Level Won, override the method "LevelEnded". Then code it to do whatever you like (show a menu). Ah ok thanks! Can you point me in the right direction on how I can make the code to popup that menu?
|
|
|
Post by DarkTonic Dev on Sept 13, 2016 17:06:29 GMT
Sorry but I haven't written much of any code with the new UI.
I would have you go ask on the Unity scripting forum for people more knowledgeable on that subject.
|
|