Esempio n. 1
0
File: Info.cs Progetto: taboo1/arena
    public void GetDestroyableInfoFromXML()
    {
        destroyableInfoDictionary = new Dictionary<string, DestroyableInfo>();

        TextAsset xmlAsset = Resources.Load("Info/DestroyableInfo") as TextAsset;

        XmlDocument xmlDoc = new XmlDocument();
        if (xmlAsset)
            xmlDoc.LoadXml(xmlAsset.text);

        foreach (XmlNode node in xmlDoc.ChildNodes[0])
        {
            int rewardEnergy = 0;
            int cost = 0;

            foreach (XmlNode childVal in node.ChildNodes)
            {
                switch (childVal.Name)
                {
                    case "rewardEnergy":
                        rewardEnergy = int.Parse(childVal.InnerText);
                        break;
                    case "cost":
                        cost = int.Parse(childVal.InnerText);
                        break;
                }
            }
            DestroyableInfo destroyableInfo = new DestroyableInfo(cost, rewardEnergy);
            destroyableInfoDictionary.Add(node.Name, destroyableInfo);
        }
    }
Esempio n. 2
0
    protected void Start()
    {
        library = GameObject.FindObjectOfType<Library>();

        destroyableInfo = Info.GetDestroyableInfo(this.GetType().Name);

        if(destroyableInfo == null)
        destroyableInfo = Info.GetDestroyableInfo("Light");
    }
Esempio n. 3
0
    protected void Start()
    {
        library = GameObject.FindObjectOfType <Library>();

        destroyableInfo = Info.GetDestroyableInfo(this.GetType().Name);

        if (destroyableInfo == null)
        {
            destroyableInfo = Info.GetDestroyableInfo("Light");
        }
    }
Esempio n. 4
0
    public void GetDestroyableInfoFromXML()
    {
        destroyableInfoDictionary = new Dictionary <string, DestroyableInfo>();


        TextAsset xmlAsset = Resources.Load("Info/DestroyableInfo") as TextAsset;

        XmlDocument xmlDoc = new XmlDocument();

        if (xmlAsset)
        {
            xmlDoc.LoadXml(xmlAsset.text);
        }

        foreach (XmlNode node in xmlDoc.ChildNodes[0])
        {
            int rewardEnergy = 0;
            int cost         = 0;

            foreach (XmlNode childVal in node.ChildNodes)
            {
                switch (childVal.Name)
                {
                case "rewardEnergy":
                    rewardEnergy = int.Parse(childVal.InnerText);
                    break;

                case "cost":
                    cost = int.Parse(childVal.InnerText);
                    break;
                }
            }
            DestroyableInfo destroyableInfo = new DestroyableInfo(cost, rewardEnergy);
            destroyableInfoDictionary.Add(node.Name, destroyableInfo);
        }
    }