Пример #1
0
 public override void OnEnter(MoonAI ai)
 {
     velocity = Vector3.zero;
     agent    = ai.GetComponent <NavMeshAgent>();
     speed    = Speed.GetValue <float>(ai.Memory);
     TargetGo = ai.Memory.GetValue <GameObject>(Target.key);
 }
Пример #2
0
        public override void OnEnter(MoonAI ai)
        {
            DetectSomething = false;
            Running         = false;

            DetectSelf  = _DetectSelf.GetValue <bool>(ai.Memory);
            SearchTag   = _SearchTag.GetValue <string>(ai.Memory);
            SaveName    = _SaveName.GetValue <string>(ai.Memory);
            ResetOnExit = _ResetOnExitSensor.GetValue <bool>(ai.Memory);

            string SensorName = _SensorName.GetValue <string>(ai.Memory);

            if (!string.IsNullOrEmpty(SensorName))
            {
                if (!ai.GetComponent <MoonPerception>())
                {
                    Debug.LogError("[MoonBehavior] No MoonPerception component detected! aborting.");
                    return;
                }
                Vision = ai.GetComponent <MoonPerception>().GetSensor(SensorName) as VisualSensor;
            }
        }
Пример #3
0
        public override TaskResult OnExecute(MoonAI ai)
        {
            Animator anim = ai.GetComponent <Animator>();

            string _param = Parameter.GetValue <string>(ai.Memory);

            if (anim != null && !string.IsNullOrEmpty(_param))
            {
                anim.SetTrigger(_param);
                return(TaskResult.Success);
            }

            return(TaskResult.Failure);
        }
Пример #4
0
 public override void OnEnter(MoonAI ai)
 {
     anim = ai.GetComponent <Animator>();
 }
Пример #5
0
 public override void OnEnter(MoonAI ai)
 {
     Mem = ai.GetComponent <MoonMemory>();
 }
Пример #6
0
 public override void OnEnter(MoonAI ai)
 {
     Mem   = ai.GetComponent <MoonMemory>();
     Agent = ai.GetComponent <NavMeshAgent>();
 }