Adam's Lair Forum
https://forum.adamslair.net:80/

[RELEASED] Frozen Core plugin - now with nuGet
https://forum.adamslair.net:80/viewtopic.php?f=18&t=319
Page 4 of 6

Author:  SirePi [ 2015/03/14, 20:16 ]
Post subject:  Re: [RELEASED] Frozen Core plugin - now with nuGet

BitteWenden wrote:
How to adjust the GUI to the screen resolution? For example if I want my textbox in the upper-left corner of the screen no matter what screen size the user has.


Well, for this you have 3 possible solutions that I can think of:
  1. Manually fix the Widget's Position during the update phase in order to keep it in the desired position - works everywhere
  2. Add the Widget as a child GameObject of your Camera - but in this case you would be fixing its position relative to the Camera itself, independently of the resolution.
  3. Set it to be drawn in ScreenOverlay mode - but this works only if you want to keep it fixed relative to the upper-left corner. Otherwise you still have to manually adjust the position by hand.

Author:  BitteWenden [ 2015/03/14, 20:48 ]
Post subject:  Re: [RELEASED] Frozen Core plugin - now with nuGet

What is the ScreenOverlay mode? If i set my GUI object to this mode it doesn't show up.

Author:  SirePi [ 2015/03/14, 20:58 ]
Post subject:  Re: [RELEASED] Frozen Core plugin - now with nuGet

Simply said, it's basically a second pass in the Draw phase where Components that are marked as ScreenOverlay are drawn.
In this pass, there is no parallax, and the origin is set to the top-left corner of the screen. Z starts from 0 and increases as stuff gets drawn "behind".
Quite useful to draw various UI elements and overlays to the Scene.

If you don't see your items, it's probably because you have to adjust their Position :)

EDIT: it's all vanilla Duality stuff, it's not made by me :mrgreen:

Author:  BitteWenden [ 2015/03/14, 21:06 ]
Post subject:  Re: [RELEASED] Frozen Core plugin - now with nuGet

That's exactly what I wanted! Works! Thanks.

Author:  Deviver [ 2015/03/21, 19:43 ]
Post subject:  Re: [RELEASED] Frozen Core plugin - now with nuGet

I was just about to come up with my own Particle Emitter, but you've already done that! :)

Is it possible to do something like firework effect with your emitter? I mean the effect when particles start from the center and the each particle moves in it's own direction. Or should I implement it myself?

Author:  SirePi [ 2015/03/22, 00:02 ]
Post subject:  Re: [RELEASED] Frozen Core plugin - now with nuGet

Deviver wrote:
I was just about to come up with my own Particle Emitter, but you've already done that! :)

Is it possible to do something like firework effect with your emitter? I mean the effect when particles start from the center and the each particle moves in it's own direction. Or should I implement it myself?

Ah, it's simple.. just use a FXPoint as the emitter's FXArea, with an InitialDirection of 0-360 (means particles can spawn in any direction in a circle) and, if you want, an InitialRotation of 0-360 as well.

Then, if you want to make a "firework" effect, I'd suggest to use around 100 particles (ParticlesAmount), with a fairly high MovementSpeed (it's in pixels/second - if you are at Z scale 1.. maybe 250-400?) and a short TimeToLive (0.3 - 0.7 seconds).

Anyway, just play around with the settings :D also they depend on your sprite.
Finally, if you want to have a real "firework" effect, set IsEnabled to false and call Emitter.Burst from code when you need it :)

Keep in mind that if you call Burst again before the effects of the first one finished (i.e. all particles are dead), it will re-initialize all particles - including those still around.

Let me know :mrgreen:

Author:  Deviver [ 2015/03/22, 09:53 ]
Post subject:  Re: [RELEASED] Frozen Core plugin - now with nuGet

So, tried your method, works quite nicely, but I've ran into an issue. Is it possible to know if the new particles are being drawn? It would be useful for me, because I want to dispose gameobject after the effect has passed. I solved this by a little hack and it works, but that just looks ugly.

Author:  SirePi [ 2015/03/22, 10:09 ]
Post subject:  Re: [RELEASED] Frozen Core plugin - now with nuGet

Uhm.. at the moment you can only know/set if an emitter is enabled or no. Didn't really think about checking also if there are particles still alive :D

Anyway it's quick to implement. Just give me a couple hours to test and put it on nuget :)

EDIT:
Well, it was easier than I thought :D
Now you can just check HasAliveParticles in the Emitter

Author:  Deviver [ 2015/03/22, 13:37 ]
Post subject:  Re: [RELEASED] Frozen Core plugin - now with nuGet

Woohoo :) Works like a charm! Thanks!

Author:  Deviver [ 2015/03/22, 16:55 ]
Post subject:  Re: [RELEASED] Frozen Core plugin - now with nuGet

Not sure where to post this, so posting here.

I have a code like this:
Code:
      void ICmpInitializable.OnInit (InitContext context)
      {
         SpriteRenderer  _sprite  = this.GameObj.GetComponent<SpriteRenderer> ();
         ParticleEmitter _emitter = this.GameObj.GetComponent<ParticleEmitter>();

         _sprite.ColorTint   = new ColorsRgba(255, 255, 255, 255);
         _emitter.ColorStart = _sprite.ColorTint;
         _emitter.ColorEnd   = _sprite.ColorTint;
      }


I tried debugging it, it goes past _emitter assigning line and crashes with NullReferenceException on assigning ColorStart() telling that the _emitter is null. I can't figure out why it does not assign anything. I'm 100% sure the ParticleEmitter exists and that there is no external influence.

Page 4 of 6 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/