Example #1
0
        void Awake()
        {
            _thisAttack          = null;
            Attacks              = new List <MeleeAttack>();
            _hitsDuringThisSwing = new List <Collider>();
            _myCollider          = GetComponent <Collider>(); // disabled for Melee in Start()

            foreach (GameObject go in AttackPrefabs)
            {
                Attacks.Add(go.GetComponent <MeleeAttack>());
            }
            Stats.CurrentAmmo = Stats.MagazineSize;
        }
Example #2
0
        private void GetMeleeAttackByInput(string input)
        {
            ///// Find a match for the inputs
            for (int i = 0; i < Attacks.Count; i++)
            {
                if (Attacks[i].InputReference == input)
                {
                    _currentAttack = i;
                    break;
                }
            }

            _thisAttack = Attacks[_currentAttack];
        }