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.


Messages - senerdude

Pages: [1]
1
Thank you, ArenMook.

I understand the problem now. I'm adding "Drag Drop Item" script and check "Clone On Drag"? so script working on cloned object. When drag end destorying cloned object.. You right my logic is wrong I assumed scritp working on original object. I need to find another way to do that.

Thanks for your time.




2
Thank you for your time ArenMook.

InvokeRepeating workng fine in OnClick().

In my game there is two kind of button. first one is clickable. second one is draggable.
Clickable ones working just fine like your sample.
but if I call InvokeRepeating from OnDragEnd() or OnDragStart() its just not working with no error.
 
Can you try to call InvokeRepeating from OnDragEnd()?

Thank you

Edit : UIDragDropItem attached to object and "Clone On Drag" is checked.


3
InvokeRepeating is not NGUI's functionality -- it's Unity's, so you need to check Unity's documentation. Note that all coroutines won't run while the component is disabled. To disable dragging of something, disabling its collider would work, but it has to be done after OnDragEnd, because the object's collider is already disabled while it's being dragged.

Thank you, I checked documentation I cound find anything about why its not working. but InvokeRepeating working everywhere except when called in your functions.. its not show error or log, like I didnt call it. is it coud be related to NGUI? 

4
Hi I have some problems with OnDragStart() OnDragEnd() events.. UIDragDropItem attached to my object and "Clone On Drag" is selected.

  1.     void OnDragStart()
  2.     {
  3.             // Change cloned drag object sprite to spell target indicator
  4.             targetIndicator = UICamera.currentTouch.dragged.GetComponent<UISprite>();
  5.             targetIndicator.spriteName = "PitsOfDefence";
  6.             targetIndicator.width = 300;
  7.             targetIndicator.height = 300;
  8.  
  9.             // Slow Time When Object Draging
  10.             Time.timeScale = 0.25f;
  11.     }
  12.  
  13. void OnDragEnd()
  14. {
  15.    // Problem One : I need to disable dragging during the cooldown. but how? I tryed to disable BoxCollider, UIDragDropItem not working.
  16.  
  17.  // gameObject.GetComponentInParent<BoxCollider>().enabled = false;
  18. // gameObject.GetComponentInParent<UIDragDropItem>().enabled = false;
  19.  
  20.   // Instantiating Spell Prefab to scene
  21.   Instantiate(spellPrefab, Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 8.5f)), Quaternion.identity);
  22.  
  23.  // Normalize Time
  24.  Time.timeScale = 1f;
  25.  
  26.  
  27. // Start Cooldown Indicator
  28. cooldownSprite.fillAmount = 1; // Fill Cooldown
  29. progressPerSecond = ((100f / (PitsofDefenceSpell.DamageDuration + 1f)) / 1000f);
  30. InvokeRepeating("ShowCoolDown", 0, 0.1f); // ( *********** Problem Two :  Its not working when fire InvokeRepeating. what is wrong? ************* )
  31.  
  32. }
  33.  
  34.     void ShowCoolDown()
  35.     {
  36.         if (cooldownSprite.fillAmount <= 0)
  37.         {
  38.             CancelInvoke();
  39.         }
  40.         cooldownSprite.fillAmount -= progressPerSecond;
  41.     }
  42.  

Thank you

Pages: [1]