예제 #1
0
        private void PlayMode(MAnimalBrain brain)
        {
            switch (affect)
            {
            case Affected.Self:

                if (brain.Animal.Mode_TryActivate(modeID, AbilityID))
                {
                    if (lookAtAlign && brain.Target)
                    {
                        brain.StartCoroutine(MTools.AlignLookAtTransform(brain.transform, brain.Target, alignTime));
                    }
                }
                break;

            case Affected.Target:
                if (brain.TargetAnimal && brain.TargetAnimal.Mode_TryActivate(modeID, AbilityID))
                {
                    if (lookAtAlign && brain.Target)
                    {
                        brain.StartCoroutine(MTools.AlignLookAtTransform(brain.TargetAnimal.transform, brain.transform, alignTime));
                    }
                }
                break;

            default:
                break;
            }
        }
예제 #2
0
        public override void StartTask(MAnimalBrain brain, int index)
        {
            if (AlignTarget != null || AlignTarget.Value == null)
            {
                brain.StartCoroutine(MTools.AlignLookAtTransform(brain.Animal.transform, AlignTarget.Value, alignTime));
            }
            else
            {
                Debug.LogWarning($"The Align Target is empty or Null");
            }

            brain.TaskDone(index);
        }
예제 #3
0
        private void PlayMode(MAnimalBrain brain)
        {
            switch (affect)
            {
            case Affected.Self:
                var Direction_to_Target = brain.Target != null ? (brain.Target.position - brain.Eyes.position) : brain.Animal.Forward;

                var EyesForward = Vector3.ProjectOnPlane(brain.Eyes.forward, brain.Animal.UpVector);
                if (ModeAngle == 360f || Vector3.Dot(Direction_to_Target.normalized, EyesForward) > Mathf.Cos(ModeAngle * 0.5f * Mathf.Deg2Rad))     //Mean is in Range:
                {
                    if (brain.Animal.Mode_TryActivate(modeID, AbilityID))
                    {
                        if (lookAtAlign && brain.Target)
                        {
                            brain.StartCoroutine(MTools.AlignLookAtTransform(brain.Animal.transform, brain.AIMovement.GetTargetPosition(), alignTime));
                        }
                    }
                }
                break;

            case Affected.Target:
                Direction_to_Target = brain.Eyes.position - brain.Target.position;                                          //Reverse the Direction
                EyesForward         = Vector3.ProjectOnPlane(brain.Target.forward, brain.Animal.UpVector);
                if (Vector3.Dot(Direction_to_Target.normalized, EyesForward) > Mathf.Cos(ModeAngle * 0.5f * Mathf.Deg2Rad)) //Mean is in Range:
                {
                    if (brain.TargetAnimal && brain.TargetAnimal.Mode_TryActivate(modeID, AbilityID))
                    {
                        if (lookAtAlign && brain.Target)
                        {
                            brain.StartCoroutine(MTools.AlignLookAtTransform(brain.TargetAnimal.transform, brain.transform, alignTime));
                        }
                    }
                }
                break;

            default:
                break;
            }
        }