/// --------------------------------------------- /// Ultimate Character Controller /// Copyright (c) Opsive. All Rights Reserved. /// https://www.opsive.com /// --------------------------------------------- namespace Opsive.UltimateCharacterController.Objects { using Opsive.UltimateCharacterController.StateSystem; using UnityEngine; /// /// Activates or deactivates the GameObject based on the state. /// public class ObjectActivator : StateBehavior { [Tooltip("Should the GameObject be activated?")] [SerializeField] protected bool m_Active = true; public bool Active { get { return m_Active; } set { m_Active = value; } } private GameObject m_GameObject; /// /// Initialize the default values. /// protected override void Awake() { m_GameObject = gameObject; base.Awake(); } /// /// The StateManager has changed the active state on the current object. /// public override void StateChange() { base.StateChange(); m_GameObject.SetActive(m_Active); } } }