using System.Collections; using System.Collections.Generic; using UnityEngine; public class WeaponVisualHandler : MonoBehaviour { public List visualWeaponSlots = new List(); Taggable owner; CastingStateController stateController; private void Awake() { owner = GetComponentInParent(); stateController = owner.GetComponentInChildren(); } // Start is called before the first frame update void Start() { stateController.OnAbilityQueued.AddListener(ToggleCorrectWeapon); } private void ToggleCorrectWeapon(BaseAbility ability) { for (int i = 0; i < visualWeaponSlots.Count; i++) { if (visualWeaponSlots[i].animationTypes.Contains(ability.animationType)) { RPC_ToggleCorrectWeapon(i); return; } } } private void RPC_ToggleCorrectWeapon(int index) { for (int i = 0; i < visualWeaponSlots.Count; i++) { for (int j = 0; j < visualWeaponSlots[i].weapons.Count; j++) { visualWeaponSlots[i].weapons[j].SetActive(i == index); } } } } [System.Serializable] public class WeaponVisualSlot { public List animationTypes = new List(); public List weapons = new List(); }