public static void Init() { if (instance != null) { return; } instance = LoadDB1(); }
public static void TriggerAbility(int ID) //for trigger and collectible that activate an ability { if (instance == null) { return; } LaunchAbility(AbilityDB.CloneItem(ID), false); }
public static void CopyFromOldDB() { Init(); if (instance.copied) { return; } instance.copied = true; instance.abilityList = AbilityDB.Load1(); }
public static List <Ability> Load() { GameObject obj = Resources.Load("DB_TDSTK/DB_Ability", typeof(GameObject)) as GameObject; #if UNITY_EDITOR if (obj == null) { obj = CreatePrefab(); } #endif AbilityDB instance = obj.GetComponent <AbilityDB>(); return(instance.abilityList); }
public static List <Ability> LoadClone() { GameObject obj = Resources.Load("DB_TDSTK/DB_Ability", typeof(GameObject)) as GameObject; AbilityDB instance = obj.GetComponent <AbilityDB>(); List <Ability> newList = new List <Ability>(); if (instance != null) { for (int i = 0; i < instance.abilityList.Count; i++) { newList.Add(instance.abilityList[i].Clone()); } } return(newList); }
[HideInInspector] public bool temporary = false; //used for weapon that is collected via collectible, cannot switch weapon and discard when out of ammo void Awake() { //make sure none of the element in shootPointList is null for (int i = 0; i < shootPointList.Count; i++) { if (shootPointList[i] == null) { shootPointList.RemoveAt(i); i -= 1; } } //if no shoot point has been assigned, use the current transform if (shootPointList.Count == 0) { shootPointList.Add(transform); } if (shootObject != null) { InitShootObject(); } aStats.Init(); //initiate the attack stats //create the ability ability = AbilityDB.CloneItem(abilityID); if (ability != null) { ability.Init(); } if (shootObject != null) { ObjectPoolManager.New(shootObject, 3); } else { Debug.LogWarning("shoot object for weapon unassigned", this); } Reset(); }
public void _AddAbility(int abID, int replaceID = -1) { Ability newAbility = AbilityDB.CloneItem(abID); if (newAbility == null) { return; } int slotID = -1; if (replaceID >= 0) { for (int i = 0; i < abilityList.Count; i++) { if (abilityList[i].ID == replaceID) { slotID = i; break; } } } if (slotID < 0) { slotID = abilityList.Count; abilityList.Add(null); } abilityList[slotID] = newAbility; abilityList[slotID].Init(); if (replaceID < 0 || slotID < 0) { TDS.NewAbility(abilityList[slotID]); } else { TDS.NewAbility(newAbility, slotID); } Select(slotID); }
public void _SetupAbility(List <int> abIDlist, bool enableAll) { abilityList = new List <Ability>(); //cloen the ability from DB list (so they dont get modified in runtime) if (enableAll) { abilityList = AbilityDB.LoadClone(); } else { for (int i = 0; i < abIDlist.Count; i++) { abilityList.Add(AbilityDB.CloneItem(abIDlist[i])); abilityList[i].Init(); } } //select an ability, if there's any Select((abilityList.Count == 0) ? -1 : 0); }
public static void LoadAbility() { abilityDB = AbilityDB.LoadDB(); for (int i = 0; i < abilityDB.abilityList.Count; i++) { if (abilityDB.abilityList[i] != null) { //abilityDB.abilityList[i].ID=i; abilityIDList.Add(abilityDB.abilityList[i].ID); } else { abilityDB.abilityList.RemoveAt(i); i -= 1; } } UpdateLabel_Ability(); TDSEditorWindow.SetAbilityDB(abilityDB, abilityIDList, abilityLabel); TDSEditorInspector.SetAbilityDB(abilityDB, abilityIDList, abilityLabel); }
public static void SetAbilityDB(AbilityDB db, List <int> IDList, string[] label) { abilityDB = db; abilityIDList = IDList; abilityLabel = label; }
public static void SetAbilityDB(AbilityDB db, List<int> IDList, string[] label) { abilityDB=db; abilityIDList=IDList; abilityLabel=label; }
public static void LoadAbility() { abilityDB=AbilityDB.LoadDB(); for(int i=0; i<abilityDB.abilityList.Count; i++){ if(abilityDB.abilityList[i]!=null){ //abilityDB.abilityList[i].ID=i; abilityIDList.Add(abilityDB.abilityList[i].ID); } else{ abilityDB.abilityList.RemoveAt(i); i-=1; } } UpdateLabel_Ability(); TDSEditorWindow.SetAbilityDB(abilityDB, abilityIDList, abilityLabel); TDSEditorInspector.SetAbilityDB(abilityDB, abilityIDList, abilityLabel); }
public void ChangeAbility(int newID) { ability = AbilityDB.CloneItem(abilityID); }