/// --------------------------------------------- /// Behavior Designer /// Copyright (c) Opsive. All Rights Reserved. /// https://www.opsive.com /// --------------------------------------------- namespace Opsive.BehaviorDesigner.Samples.SceneManagers { using Opsive.BehaviorDesigner.Runtime; using UnityEngine; /// /// Manages the melee combat scene. /// public class MeleeCombatSceneManager : MonoBehaviour { [Header("Agent")] [Tooltip("A reference to the behavior tree agent.")] [SerializeField] protected GameObject m_Agent; [Header("Opponent")] [Tooltip("A reference to the behavior tree opponent.")] [SerializeField] protected GameObject m_Opponent; /// /// Initializes the default values. /// private void Awake() { var behaviorTree = m_Agent.GetComponent(); var sharedVariable = behaviorTree.GetVariable("Opponent"); sharedVariable.Value = m_Opponent; behaviorTree = m_Opponent.GetComponent(); sharedVariable = behaviorTree.GetVariable("Opponent"); sharedVariable.Value = m_Agent; } } }