//sets the active attack public void SetActiveAttack(int ID) { activeAttack = AttackEntities[ID]; //new active attack activeAttack.Toggle(true); activeAttack.FactionEntity.UpdateAttackComp(activeAttack); activeAttack.GetWeapon()?.Toggle(true); //enable the wepaon object }
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 }