Exemple #1
0
        public override void OnLoadAsset(XmlReader reader)
        {
            base.OnLoadAsset(reader);

            switch (reader.Name)
            {
            case "StatLinker":
                string statAssetType = reader.GetAttrString("Type", "");

                RPGStatLinkerAsset statLinker = RPGStatLinkerUtility.CreateAsset(statAssetType);
                if (statLinker != null)
                {
                    statLinker.OnLoadAsset(reader);
                    StatLinkers.Add(statLinker);
                }
                else
                {
                    Debug.LogErrorFormat("[StatLinker]: Could not create linker of type {1}", statAssetType);
                }
                break;

            default:

                if (StatLinkers.Count > 0)
                {
                    StatLinkers[StatLinkers.Count - 1].OnLoadAsset(reader);
                }
                break;
            }
        }
 /// <summary>
 /// Basic constructor that only takes a stat linker asset and
 /// a linked stat. Listens to the Stat's OnValueChange
 /// event if the stat implements IStatValueChange.
 /// </summary>
 public RPGStatLinker(RPGStatLinkerAsset asset, RPGStat linkedStat)
 {
     SetLinkedStat(linkedStat);
 }
 /// <summary>
 /// Basic constructor that only takes a stat linker asset
 /// </summary>
 /// <param name="asset"></param>
 public RPGStatLinker(RPGStatLinkerAsset asset)
 {
     SetLinkedStat(null);
 }