Пример #1
0
 public static void Init()
 {
     if (instance != null)
     {
         return;
     }
     instance = LoadDB1();
 }
Пример #2
0
        public static void TriggerAbility(int ID)               //for trigger and collectible that activate an ability
        {
            if (instance == null)
            {
                return;
            }

            LaunchAbility(AbilityDB.CloneItem(ID), false);
        }
Пример #3
0
        public static void CopyFromOldDB()
        {
            Init();
            if (instance.copied)
            {
                return;
            }

            instance.copied      = true;
            instance.abilityList = AbilityDB.Load1();
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #6
0
        [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();
        }
Пример #7
0
        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);
        }
Пример #8
0
        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);
        }
Пример #9
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);
        }
Пример #10
0
 public static void SetAbilityDB(AbilityDB db, List <int> IDList, string[] label)
 {
     abilityDB     = db;
     abilityIDList = IDList;
     abilityLabel  = label;
 }
Пример #11
0
 public static void SetAbilityDB(AbilityDB db, List<int> IDList, string[] label)
 {
     abilityDB=db;
     abilityIDList=IDList;
     abilityLabel=label;
 }
Пример #12
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);
        }
Пример #13
0
 public void ChangeAbility(int newID)
 {
     ability = AbilityDB.CloneItem(abilityID);
 }