Untitled
unknown
csharp
4 years ago
1.2 kB
7
Indexable
using System.Collections; using System.Collections.Generic; using UnityEngine; public class IntroRoomNPCAnimatorActivator : MonoBehaviour { public roomIntroBase[] roomsIntroBase; [ContextMenu("DisableAllAnimators")] public void DisableAllAnimators() { foreach(roomIntroBase room in roomsIntroBase) { foreach (Animator animator in room.npcAnimators) { animator.enabled = false; } } } public void DisableAnimatorsInRoom(int roomIndex) { roomIntroBase room = roomsIntroBase[roomIndex]; foreach(Animator animator in room.npcAnimators) { animator.enabled = false; } } public void EnableAnimatorsInRoom(int roomIndex) { roomIntroBase room = roomsIntroBase[roomIndex]; foreach (Animator animator in room.npcAnimators) { animator.enabled = true; } } private void Update() { if(Input.GetKeyDown(KeyCode.T)) { DisableAllAnimators(); } } } [System.Serializable] public class roomIntroBase { public int roomIndex; public Animator[] npcAnimators; }
Editor is loading...