Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - maxdev

Pages: [1]
1
Hello,

I am implementing a powerup menu that that has icons pop out and close after the player clicks a powerup.
My issue is I want the powerup menu's icons to reset to their hidden positions after the panel holding the menu is set to inactive.
So I figured the resetIfDisabled should do just that, so I call that in the start function on the power menu script.

This is how my hierarchy is set up:

--PowerupPanel
----PowerupMenu <-- Has following script attached, a collider and a UIPlayTween(Play Direction is set to Toggle) for each Powerup.
--------PowerupA - Has Tween Position to pop the powerup out.
--------PowerupB - Has Tween Position to pop the powerup out.
--------PowerupC - Has Tween Position to pop the powerup out.

The script I have attached to the PowerupMenu:

  1. void Start () {
  2.         foreach (UIPlayTween ptt in gameObject.GetComponents<UIPlayTween>())
  3.         {
  4.             ptt.resetIfDisabled = true;
  5.         }
  6.  
  7.         foreach(UIPlayTween pt in transform.GetComponentsInChildren<UIPlayTween>(true))
  8.         {
  9.             pt.resetIfDisabled = true;
  10.         }      
  11.         }
  12.  

What happens is the powerup menu works but when I hide and unhide the panel the state they
are in stays, meaning they dont return to their original hidden positions.

Any help or insight would be very appreciated!

Thanks,
Max

2
NGUI 3 Support / Passing Instance References Via EventDelegate
« on: April 17, 2014, 12:30:23 PM »
Hey guys,

I am making a combo system that gets an array of positions and spawns sprites.
I then move these sprites to the score on the top left of the screen via TweenPosition. When they reach the end of the tween, I'd like to run a function and pass the object that finished to it.

This is basically what works, however, I have no idea how to pass the gameobject(insc) to that function:
EventDelegate.Add(insc.GetComponent<TweenPosition>().onFinished, AddToScore);

I'd definitely love some input on this as I tried reading the docs and only found a way
to read parameters but not write.

Thanks very much!
Max

3
NGUI 3 Support / Having UILabel Follow Object in Scene
« on: April 11, 2014, 11:06:38 PM »
Hey guys,

I am trying to have a UILabal move and essentially follow an object in the scene.
I tried doing WorldSpaceToViewport and ToScreen on NGUI's camera and moving the object with MoveTowards. But the results are that it shoots off to the side and isnt sitting on top of the object. The only way I found is to disable NGUI's camera and use my regular Main Camera, but this seems moot.

Any suggestions will be very appreciated!

Thanks!

Pages: [1]