Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Search the Community

Showing results for tags 'list'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GENERAL
    • Introduce yourself
    • Discussions
    • Showcase
    • Need help?
    • Seeking team members?
    • Offtopic
  • RESOURCES
    • unity3D | Example Projects
    • unity3D | Scripts
    • unity3D | Shaders
    • unity3D | Tutorials
    • 3D models
    • Animated 3D Models
    • Graphic design
    • Textures
    • Sounds
    • Other
  • FREE FPS PROJECT
    • FPSKit Download
    • FPSKit Modifications/Tutorials
    • FPSKit WIP/Showcase
    • Discussions / Bug reports
  • SELL | REQUEST
    • Sell
    • Request
  • Mars' Modular Multiplayer Photon FPS Kit's Topics
  • Mars' Modular Multiplayer Photon FPS Kit's Reviews
  • Mars' Modular Multiplayer Photon FPS Kit's Updates
  • Mars' Modular Multiplayer Photon FPS Kit's Tutorials
  • Busy People's Introductions
  • Photon's Tutorials
  • Photon's Photon General
  • Photon's Showcase

Categories

  • Free Projects
  • Free Assets
  • Game Demos
  • Photon's Files

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


YouTube URL


Facebook URL


Twitter URL


IndieGoGo URL


Kickstarter URL


IndieDB URL


GreenLight URL


Location:


Interests

Found 4 results

  1. Hello guys, i'm having some problem with a list and a "for" loop instance. I need to enable a specific number of cubes when i press "space", but i only need to enable the cubes that have a bool disabled in a script attached to each one. The problem is that my script only enable 1 cube for button press, but i want to enable a quantity declared with an int value. I'm sure that i forget something. Have a look at the script here below public List<GameObject> lockedSlots; //the list that contains the cubes that i can enable public int lockedSlotsQuantity; //the lenght of the list of cubes public int totalSlots; //total slots public int slotsToUnlock; //this is the int that (should) manage how many cubes must enable when i press the button void Start () { totalSlots = 20; //for example i set the inventory with already 20 other items, just for test lockedSlotsQuantity = lockedSlots.Count; //from here i get the quantity (lenght) of the list that contains the cubes } void Update () { if (Input.GetKeyDown(KeyCode.Space)) //when i press the button, perform the action { UnlockSlots(); } } void UnlockSlots() { for (int i = 0; i < lockedSlots.Count; i++) { while (lockedSlots[i] == lockedSlots[i].GetComponent<SlotTest>().lockedSlot) //cubes that can be enabled must have the bool "lockedSlot" { lockedSlots[i].SetActive(true); //enable the cube lockedSlots[i].GetComponent<SlotTest>().lockedSlot = false; //modify its bool lockedSlots.Remove(lockedSlots[i]); //remove it from the list totalSlots += slotsToUnlock; lockedSlotsQuantity -= slotsToUnlock; break; } } } The problem is that, if i set the "slotToUnlock" int to 2 (to unlock 2 cubes when I press the button), it just enable one cube. Hope that some one can help! Thanks
  2. arwe2793

    unity cs and xml database quostion

    hey guys, i trying to make shop for my game with xml, right now i hawe working database... the isue i need put all shop item by hand and set its value inside hierarchy script, if i hawe hundresds of items, each item hawe 11 diferent variables as stats, its litle bit time consuming :D. i need that program would it self find all objects and put it to list, then get all values (int's and float's) from xml file and attack it to list. using UnityEngine; using System.Collections; using System.Collections.Generic; using System.Xml; using System.Xml.Serialization; using System.IO; public class XMLserialize : MonoBehaviour { public static XMLserialize ins; public GameObject player; public ItemDatabase itemDB; void Awake () { ins = this; } private void PreloadPlayerItemsToList (){ } public void SaveItems (){ XmlSerializer serializer = new XmlSerializer(typeof(ItemDatabase)); FileStream stream = new FileStream (Application.dataPath + "/StreamingAssets/Xml/item_Data.xml", FileMode.Create); serializer.Serialize (stream, itemDB); stream.Close (); } public void LoadItems (){ XmlSerializer serializer = new XmlSerializer (typeof(ItemDatabase)); FileStream stream = new FileStream (Application.dataPath + "/StreamingAssets/Xml/item_Data.xml", FileMode.Open); itemDB = serializer.Deserialize (stream) as ItemDatabase; stream.Close (); } void PrepareToBuy (){ SaveItems (); } public void EditDatabaseEntries (int ThisId){ itemDB.list[ThisId].boughtStatus = true; SaveItems (); } } [System.Serializable] public class ItemEntry { // ginklo info listas public string gunName; public string gunType; public int price; public int spriteId; public bool boughtStatus; public int damage; public int clipSize; public float accuracy; public float fireRate; public float Weight; public float reloadSpeed; } [System.Serializable] public class ItemDatabase { //clases itemEntry info listu masyvas [XmlArray("Weapons")] public List<ItemEntry> list = new List<ItemEntry>(); void start (){ foreach (GameObject gun in GameObject.FindGameObjectsWithTag ("gun")) { //list.Add (gun); //this is where my issue } } } as you can see itemenry class is item stats that will be in list. itemdatabase class is list it slef, i can put items as gameobjects but that prompts error. (i did that in end of the script with foreach x.x) how to get all objects from hierarchy and stats then put everything to damn list thank you
  3. reaperkan

    Server List

    Hey, I was coding my server list the other day, and i did a stress test. The server list was made on the new UI and it instantiated a prefab for every room hosted on server. After about 100 games it started lagging like anything and the game crashed. Why did it happen? Is there another way to do it? If so what would you have done>
  4. Hi, so i have a little problem, with not equal to the right variable properties, i bet it is the for loop is something wrong with and i know it is. This is the MobAI script: using UnityEngine; using System.Collections; [RequireComponent(typeof(NavMeshAgent))] public class MobAI : MonoBehaviour { MobCreator mc; public float health = 57f; public float minDamage = 5f; public float maxDamage = 10f; public float scale = 1f; public float attackSpeed = 1500f; public string runAnim; public string walkAnim; public string idleAnim; public bool attackable; float distance; int i = 0; NavMeshAgent nma; void Awake() { mc = GameObject.Find("_CREATORSCRIPTS").GetComponent<MobCreator>(); nma = GetComponent<NavMeshAgent>(); } void Start() { } // Update is called once per frame void Update () { distance = Vector3.Distance(GameObject.FindWithTag("Player").transform.position, transform.position); if(distance <= 15 && distance > 2f) { nma.SetDestination(GameObject.FindWithTag("Player").transform.position); } for(int i = 0; i < mc.mobCreator.Count; i++) { Debug.Log("For start"); health = mc.mobCreator[i].health; minDamage = mc.mobCreator[i].minDamage; maxDamage = mc.mobCreator[i].maxDamage; scale = mc.mobCreator[i].scale; nma.speed = mc.mobCreator[i].runSpeed; attackSpeed = mc.mobCreator[i].attackSpeed; runAnim = mc.mobCreator[i].runAnim; walkAnim = mc.mobCreator[i].walkAnim; idleAnim = mc.mobCreator[i].idleAnim; attackable = mc.mobCreator[i].attackable; Debug.Log("For end"); } } } Then the mobcreator script(A script for easy making new mobs in inspector): using UnityEngine; using System.Collections; using System.Collections.Generic; public class MobCreator : MonoBehaviour { [System.Serializable] public class Mob { public enum MobType { Normal, Elite, Boss } public enum MobTypeState { Hostile, Aggressive, Friendly } public enum MobDamageType { Physical, Ranged, PhysicalAndRanged, Fire, Arcane, Earth, Frost } public string name = "Unnamed"; public float health = 57f; public float minDamage = 5f; public float maxDamage = 10f; public int minLevel = 1; public int maxLevel = 10; public float scale = 1f; public float runSpeed = 4f; public float attackSpeed = 1500f; public GameObject mob; public string runAnim; public string walkAnim; public string idleAnim; public MobType mobType; public MobTypeState mobTypeState; public MobDamageType mobDamageType; public bool attackable; } public List<Mob> mobCreator = new List<Mob>(); // Use this for initialization void Start () { GameObject mobTest = (GameObject)Instantiate(mobCreator[0].mob, GameObject.Find("MobSpawn").transform.position, Quaternion.identity); } // Update is called once per frame void Update () { } } Example to what i want: I have 3 mobs in the mobcreator list, Thug, thief and rat so i instantiate Thug, and the instantiated thug should have the variable properties from the thug in the list, but instead it does so the thug variable properties is equals to the last in the list which is the rat, so the thug has the rat properties which i don't want, what i want is the thug has the thug properties and thief has the thief properties and rat has the rat properties, because it doesn't really make sense if i have a thug with rat properties or a thief with rat properties So i appreciate any help i can get, and i appreciate tips on how i could make things better. Also a link to screenshot below shows the list i have of the mobs https://www.dropbox.com/s/mffz2b6s1v43mtb/Settings.png
×