Beispiel #1
0
 /// <summary>
 /// Assign new Behaviour model to Agent.
 /// </summary>
 /// <param name="behaviour"></param>
 public void SetBehaviour(EliotBehaviour behaviour)
 {
     try{
         _behaviour     = behaviour;
         _behaviourCore = CoresPool.GetCore(_behaviour, gameObject);
     }catch (Exception) { /**/ }
 }
Beispiel #2
0
        /// <summary>
        /// Initialize Agent on scene load.
        /// </summary>
        private void Start()
        {
            Unit = GetComponent <Unit>();
            var qa = GetComponent <Agent>();

            foreach (var skill in _skills)
            {
                _usableSkills.Add(skill.Clone().Init(qa, gameObject));
            }

            _resources.Init(qa);
            _perception.Init(qa);
            _motion.Init(qa);
            _generalSettings.Init(qa);
            _inventory.Init(qa, FindTransformByName("__inventory__"));
            _agentAnimation.Init(qa);

            DefaultGraphics = new List <GameObject>();
            var container = GetGrapgicsContainer();

            if (container.childCount > 0)
            {
                for (var i = container.childCount - 1; i >= 0; i--)
                {
                    DefaultGraphics.Add(container.GetChild(i).gameObject);
                }
            }

            DefaultPerceptionOriginPosition = GetPerceptionOrigin().localPosition;
            DefaultPerceptionOriginRotation = GetPerceptionOrigin().localRotation;

            DefaultSkillOriginPosition = GetSkillOrigin().localPosition;
            DefaultSkillOriginRotation = GetSkillOrigin().localRotation;

            DefaultAnimationMode = _agentAnimation.AnimationMode;

            if (!_behaviour)
            {
                return;
            }
            _behaviourCore = CoresPool.GetCore(_behaviour, gameObject);
        }