Beispiel #1
0
        /// <summary>
        /// Check and apply aoi from a certain seeekr.
        /// </summary>
        /// <param name="seeker">our seeker.</param>
        /// <param name="distance">seeking distance</param>
        public static void CheckTargets(UNSeeker seeker, float distance)
        {
            if (ThreadManager.instance == null)
            {
                return;
            }

            UNTarget target;
            ThreadTask <UNTarget, UNSeeker, Vector3, bool> task;

            for (int i = 0; i < worldTargets.Count; i++)
            {
                target = worldTargets[i];

                if (target.InDistance(seeker))
                {
                    task = new ThreadTask <UNTarget, UNSeeker, Vector3, bool>((UNTarget _target, UNSeeker _seeker, Vector3 _seekerPos, bool playing) =>
                    {
                        _target.Check(_seeker, _seekerPos, _seeker.seekingDistance, playing);
                    }, target, seeker, target.FixPosition(seeker.transform.position), Application.isPlaying);

                    if (target.useMultithreadedCheck)
                    {
                        ThreadManager.instance.RunOnThread(task);
                    }
                    else
                    {
                        task.Invoke();
                    }
                }
            }
        }