예제 #1
0
        // -------------------------------------------------------------------------------
        // Init
        // -------------------------------------------------------------------------------
        public void Init(GameObject _parent = null, int level = 1)
        {
            base.Init(_parent);

            syncEnergies.Clear();

            foreach (BaseEnergy energy in defaultEnergies)
            {
                if (energy.template != null)
                {
                    SEnergy sEnergy = new SEnergy(energy.template.GetId, energy.value.Get(level));
                    syncEnergies.Add(sEnergy);
                }
            }
        }
예제 #2
0
        // -------------------------------------------------------------------------------
        // Load
        // -------------------------------------------------------------------------------
        public override void Load(BaseDataTable data)
        {
            syncEnergies.Clear();

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

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

            data.Cleanup();
        }