예제 #1
0
        public void EnableAttackLocal(int ID)
        {
            //make sure the attack isn't already enabled and that the attack ID is valid
            if (ID < 0 || ID >= AttackEntities.Length || AttackEntities[ID] == activeAttack)
            {
                return;
            }

            if (activeAttack != null)                    //if there was a previously active attack
            {
                activeAttack.Stop();                     //stop if there's a current attack
                activeAttack.Reset();                    //reset it
                activeAttack.Toggle(false);              //deactivate it
                activeAttack.GetWeapon()?.Toggle(false); //disable the wepaon object
            }

            SetActiveAttack(ID);

            CustomEvents.OnAttackSwitch(activeAttack); //trigger custom event
        }