Ejemplo n.º 1
0
        // -------------------------------------------------------------------------------
        // Init
        // -------------------------------------------------------------------------------
        public void Init(GameObject _parent = null, List <TemplateAspect> _defaultAspects = null)
        {
            base.Init(_parent);
            syncAspects.Clear();
            defaultAspects.AddRange(_defaultAspects);

            for (int i = 0; i < defaultAspects.Count; ++i)
            {
                SAspect sAspect = new SAspect(defaultAspects[i].GetId);
                syncAspects.Add(sAspect);
            }
        }
Ejemplo n.º 2
0
        // -------------------------------------------------------------------------------
        // Load
        // -------------------------------------------------------------------------------
        public override void Load(BaseDataTable data)
        {
            syncAspects.Clear();

            for (int i = 0; i < data.Rows.Count; ++i)
            {
                TemplateAspect tmpl;

                if (DataManager.dictAspect.TryGetValue(data.GetIdHash(i), out tmpl))
                {
                    SAspect sAspect = new SAspect(tmpl.GetId, data.GetLongAsInt(DatabaseManager.fieldValue, i));
                    syncAspects.Add(sAspect);
                }
                else
                {
                    Debug.LogWarning("Skipped template '" + data.GetString(DatabaseManager.fieldName) + "' as it was not found in Library.");
                }
            }

            data.Cleanup();
        }