Exemple #1
0
 protected override void DestroyInternal()
 {
     if (_gameObject != null)
     {
         GameObject.Destroy(_gameObject);
         _gameObject     = null;
         _transform      = null;
         _agentBehaviour = null;
         _isActive       = false;
     }
 }
Exemple #2
0
        public AgentModule(string gameObjectName, string prefabName, Vector3 worldPosition)
        {
            var prefab = Resources.Load <AgentBehaviour>(prefabName);

            if (prefab == null)
            {
                throw new Exception($"AgentBehaviour prefab not found in Resources: {prefabName}");
            }

            _agentBehaviour  = GameObject.Instantiate <AgentBehaviour>(prefab, worldPosition, Quaternion.identity);
            _transform       = _agentBehaviour.transform;
            _gameObject      = _agentBehaviour.gameObject;
            _gameObject.name = gameObjectName;
        }