Example #1
0
        public override void StartTask(MAnimalBrain brain, int index)
        {
            Transform child = null;

            if (SetLookAtOn == Affected.Self)
            {
                if (UseTag)
                {
                    child = GetGameObjectByTag(brain.Target);
                }
                else
                {
                    child = GetChildName(brain.Target);
                }

                brain.GetComponentInParent <IAim>()?.SetTarget(child);
            }
            else
            {
                if (UseTag)
                {
                    child = GetGameObjectByTag(brain.Animal.transform);
                }
                else
                {
                    child = GetChildName(brain.Animal.transform);
                }

                brain.Target?.GetComponentInParent <IAim>()?.SetTarget(child);
            }
        }
Example #2
0
        public override void StartTask(MAnimalBrain brain, int index)
        {
            Transform child;

            if (SetLookAtOn == Affected.Self)
            {
                if (LookAtTargetS == LookAtOption1.CurrentTarget)
                {
                    child = UseTag ? GetGameObjectByTag(brain.Target) : GetChildName(brain.Target);
                }
                else
                {
                    child = UseTag ? GetGameObjectByTag(TargetVar.Value) : GetChildName(TargetVar.Value);
                }
                brain.GetComponentInParent <IAim>()?.SetTarget(child);
            }
            else
            {
                if (LookAtTargetT == LookAtOption2.AIAnimal)
                {
                    child = UseTag ? GetGameObjectByTag(brain.Animal.transform) : GetChildName(brain.Animal.transform);
                }
                else
                {
                    child = UseTag ? GetGameObjectByTag(TargetVar.Value) : GetChildName(TargetVar.Value);
                }

                brain.Target?.GetComponentInParent <IAim>()?.SetTarget(child);
            }

            brain.TaskDone(index);
        }