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 - Demigoth

Pages: [1] 2
1
NGUI 3 Support / UICheckbox
« on: August 29, 2014, 04:21:35 PM »
Hi,

I am trying to use the checkboxes but I cannot find the UICheckbox script anywhere, has this changed in the recent release? How do I send and receive the changes when is checked and unchecked.

Thank you in advance,

Demigoth

2
Other Packages / Re: NGUI HUDText is a bit shaky
« on: August 08, 2014, 05:05:38 PM »
Yes,  I am moving the main camera but not the uicamera.

3
Other Packages / NGUI HUDText is a bit shaky
« on: August 08, 2014, 10:13:20 AM »
Hi, so I am making a 2D endless runner, but I am using the hudtext to add some flavor to the game when you pick up stuff, so I was wondering if there is any reason why the HUDText is shaking a bit when i set it to follow the runner? I have the object moving back and forth on the x axis for like 0.3f constantly and that makes the HUDText.Add all shaky when it comes in contact with the colliders.

is it because the runner movement? is there some kind of delay on the HUD?

Thank you for your support ArenMook.

4
NGUI 3 Support / Help with healthbars and using PoolManager
« on: May 27, 2014, 09:41:19 PM »
Hey guys,

I am looking for someone to explain this a bit further for me. I am using a poolmanager and I pool the healthbars using the poolmanager. so here is how I spawn both the units and the healthbars...

  1. IEnumerator WaveSpawning ()
  2.         {
  3.                 //Debug.Log ("Waves Started");
  4.                 for (int j = 0;j < waveCount; j++)
  5.                 {
  6.                         waveNumber = waveNumber + 1;
  7.                         waveLabel.text = "Wave: " + waveNumber.ToString() + "/" + waveCount.ToString();
  8.                         for (int i = 0; i < enemyCount; i++)
  9.                         {
  10.                                 int prefabIndex = UnityEngine.Random.Range(0,3);
  11.                                 //Debug.Log("Unit spawned was" + prefabIndex);
  12.                                 _spawnedUnit = prefabList[prefabIndex];
  13.                                 Transform enemy = PoolManager.Pools ["Enemy"].Spawn (_spawnedUnit, spawnPoint.position, Quaternion.identity);
  14.                                 Transform healthbar = PoolManager.Pools ["HBPool"].Spawn (spawnedHB, spawnPoint.position, Quaternion.identity);
  15.  
  16.                                 yield return new WaitForSeconds (spawnWait);
  17.                         }
  18.                         yield return new WaitForSeconds (waveWait);
  19.                 }
  20.                 if (waveNumber == waveCount)
  21.                 {
  22.                         wavesCompleted = true;
  23.                 }
  24.         }
  25.  

Now I spawn several units as you see the script and I need to assign each healthbar with each enemy unit and make them follow them. I have tried different approaches to get the UIFollowTarget but they dont work correctly so far. I tried to use the scripts on both Transforms but it gets messed up. Something like this on the enemy script Start() Function...

  1. void Start()
  2.         {
  3.                 EnemyMobScript.livesCost = this.lives;
  4.                 enemyUnit = this.transform;
  5.                 setHBPos = this.hbPos;
  6.         }
  7.  

And this on the Update() function of the healthbar script...

  1. void Update ()
  2.         {
  3.                 enemyUnit = EnemyMobScript.setHBPos.transform;
  4.                 UIFollowTarget.setTarget = enemyUnit;
  5.         }
  6.  

So far without any luck, can any of you guys please give me a hand with this? just pointers on how to do the reference correctly as that is the one point im struggling with.

Thanks in advance. BTW ArenMook I know this functions are not supported by NGUI but I want to support the HUD NGUI functions for my game and working on learning.

Demigoth

5
NGUI 3 Support / Pool Manager with NGUI
« on: April 21, 2014, 06:36:08 PM »
Hey ArenMook,

Do you have any experience with this? I am trying to spawn and locate a menu on top of a clickable object, but so far I have been unsuccessful, I will post some of the code I have been trying. By the way, I am using the UI follow target script on the menu, and the pool is a child of the UI object. The UI Follow Target has the game camera and the UI camera set. Any help on this would be greatly appreciated.


  1.         public Transform uiTowerMenu;
  2.         public static Transform slotPos;
  3.         public static GameObject slotPrefab;
  4.  
  5.         void OnMouseDown()
  6.         {
  7.                 //Debug.Log ("The object was clicked on!");
  8.                 slotPos = this.transform;
  9.                 slotPrefab = this.gameObject;
  10.  
  11.                 PoolManager.Pools ["GUIElements"].Spawn (uiTowerMenu, slotPos.position, Quaternion.identity);
  12.         }
  13.  

6
NGUI 3 Support / Re: hide the menu when clicked outside of it
« on: March 29, 2014, 11:39:31 AM »
Hey Aren,

but where do I put this script on, to set up the focus.

7
NGUI 3 Support / hide the menu when clicked outside of it
« on: March 26, 2014, 08:07:47 PM »
Hey guys, so I am working on my game and got this menu show up when I click an in-game object, now the menu wont dissapear until I actually use the stuff its inside, but I wanted to know if there is any way to trigger it to hide when I click outside of it.

8
Hey Yukichu,

Can you give me a hand on how you do this?, the pool is a UI child, now how do I actually assign this spawned healthbar to the freshly spawned mob. how do I actually create this reference.

9
Hey ArenMook,

Have you ever tried this with a poolmanager? I mean all my enemies that spawn come from instances of a mob, how can I link which one updates which one.

10
NGUI 3 Support / Instantiate health bar created for several enemies
« on: March 22, 2014, 06:39:16 PM »
Hey ArenMook,

So I created this healthbar with a progress bar, but I want to use this for all the enemies that spawn in my game, is there any way to assign it to the instances of the enemies and instantiate this object for each one of them?

Or do I need to create the healthbars outside the GUI? any help would be greatly appreciated!

11
NGUI 3 Support / Re: NGUI with HUD Text
« on: March 15, 2014, 06:26:38 PM »
Hey ArenMook,

I can get the NGUI button to show with OnMouseDown() because the gameobject is not part of the GUI, what I cant make is make it appear on top of the clicked object, I want it appear on top of the gameobject I just clicked, right now it appears but its fixed on the position I created it.

12
NGUI 3 Support / Tower Defense Tower Spawning
« on: March 15, 2014, 05:32:11 PM »
Hey ArenMook,

I was wondering if you could give me a hand on this, I tried it already by myself and somehow I cant get the object to instantiate correctly, first lets say I am making a tower defense game, and I am using both NGUI and HUD TEXT extension. Second point, I have the places where I can spawn the towers so when I click on them I get a NGUI menu to popup and I select the tower and it spawns it.
Now I am facing 2 problems here. First, the menu is a custom panel with 4 buttons, and I deactivate it, so I called it from a script on the towerslot to make it appear, there are several towerslots on the game so I want the panel to appear on top of any when I click on them, I tried using the UIFollowTarget but it doesnt work correctly with all the prefabs of the towerslots.

Second, when I click on the tower I want to instantiate, I get this code to do it but it doesn't instantiate on the towerslot, it does instantiate on the UI object location. Any advice would be great, I was trying to store the towerslot position inside a variable but that doesn't work or I might be doing it wrong.

This is the code for the Tower instantiation...

  1. public GameObject archerTower = null;
  2.         // Use this for initialization
  3.         void OnClick ()
  4.         {
  5.                 if (Player.gold >= ArcherTowerStats.towerCost)
  6.                 {
  7.                         Player.gold -= ArcherTowerStats.towerCost;
  8.  
  9.                         Instantiate (archerTower, transform.position,  Quaternion.identity);
  10.  
  11.                         gameObject.SetActive(false);
  12.                 }
  13.         }
  14.  

13
NGUI 3 Support / Re: NGUI with HUD Text
« on: March 14, 2014, 11:29:22 PM »
Update... I was using the UIFollowTarget script and it works on the first slot but it doesn't work when there are several of the same items on the game, it is a tower defense game and as you might guess, there are several of these spawning points for the towers. Any idea how to do it?

14
NGUI 3 Support / NGUI with HUD Text
« on: March 14, 2014, 11:20:47 PM »
Hey guys,

So I got this NGUI button hidden, when I click this GameObject not part of the NGUI using something like this, I can get the button to appear, but I want it to appear on top of the GameObject I clicked... please I need help with this, I cant make it work so I bought HUD Text to get a help with it... btw here is the code.

  1. public class TowerSlot : MonoBehaviour
  2. {
  3.         public GameObject towerMenu = null;
  4.  
  5.        
  6.         void OnMouseDown()
  7.         {
  8.                 NGUITools.SetActive (towerMenu,true);
  9.         }
  10.  
  11. }
  12.  

15
NGUI 3 Support / Assign a variable value to a UILabel
« on: March 13, 2014, 09:40:38 PM »
Hey guys,

So I have these variables in a Player.cs file, like health and gold and a bunch of public variables that constantly change in game, so I was wondering I have a UITexture with a child UILabel on it but I cant seem to find a way to assign the label text this variables value. Any help would be greatly appreciated. I was trying something like this:

  1. public UILabel healthLabel;
  2.  
  3. void Update()
  4. {
  5.      healthLabel.text = Player.health.ToString();
  6. }
  7.  

Any help would be great!

Victor

Pages: [1] 2