Ejemplo n.º 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);
 }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
 public override void OnEnter(MoonAI ai)
 {
     anim = ai.GetComponent <Animator>();
 }
Ejemplo n.º 5
0
 public override void OnEnter(MoonAI ai)
 {
     Mem = ai.GetComponent <MoonMemory>();
 }
Ejemplo n.º 6
0
 public override void OnEnter(MoonAI ai)
 {
     Mem   = ai.GetComponent <MoonMemory>();
     Agent = ai.GetComponent <NavMeshAgent>();
 }