示例#1
0
        public static void TriggerAbility(int ID)               //for trigger and collectible that activate an ability
        {
            if (instance == null)
            {
                return;
            }

            LaunchAbility(AbilityDB.CloneItem(ID), false);
        }
示例#2
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();
        }
示例#3
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);
        }
示例#4
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);
        }
示例#5
0
 public void ChangeAbility(int newID)
 {
     ability = AbilityDB.CloneItem(abilityID);
 }