This commit is contained in:
2026-06-14 23:57:44 +07:00
parent 20f9010787
commit 78d7b2f5a7
5775 changed files with 4796241 additions and 5 deletions

View File

@@ -0,0 +1,44 @@
/// ---------------------------------------------
/// Ultimate Character Controller
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.UltimateCharacterController.Objects
{
using Opsive.UltimateCharacterController.StateSystem;
using UnityEngine;
/// <summary>
/// Activates or deactivates the GameObject based on the state.
/// </summary>
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;
/// <summary>
/// Initialize the default values.
/// </summary>
protected override void Awake()
{
m_GameObject = gameObject;
base.Awake();
}
/// <summary>
/// The StateManager has changed the active state on the current object.
/// </summary>
public override void StateChange()
{
base.StateChange();
m_GameObject.SetActive(m_Active);
}
}
}