/// <summary> /// Check if the seeker is in range of the terrain. /// </summary> /// <param name="seeker">Seeker</param> /// <returns>in range?</returns> public override bool InDistance(Seekers.UNSeeker seeker) { Vector2 tMin = new Vector2(terrain.transform.position.x - distanceOffset, terrain.transform.position.z - distanceOffset); Vector2 tMax = new Vector2(terrain.transform.position.x + tData.size.x + distanceOffset, terrain.transform.position.z + tData.size.z + distanceOffset); Vector2 sPos = new Vector2(seeker.transform.position.x, seeker.transform.position.z); return((tMin.x < sPos.x && tMin.y < sPos.y) && (tMax.x > sPos.x && tMax.y > sPos.y)); }
/// <summary> /// Check for seeker on terrain. /// </summary> /// <param name="seeker">Our seeker.</param> /// <param name="seekerPos">the seeker pos</param> public override void Check(Seekers.UNSeeker seeker, Vector3 seekerPos, float seekingDistance, bool isPlaying) { TIChunk treeInstancesChunk; #region Tree Instaces if (isPlaying && manageTrees) { var chunks = sector.getChunks(seekerPos, seeker.seekingDistance, true); for (int i = 0; i < chunks.Count; i++) { treeInstancesChunk = chunks[i] as TIChunk; if (treeInstancesChunk != null) { treeInstancesChunk.CheckForNearbyTreeInstances(seeker, this); } } } #endregion }
/// <summary> /// Check and apply AOI from seeker. /// <param name="seeker">Our seeker</param> /// <param name="seekerPos">the seeker position -> in order to maintain multithreading.</param> /// </summary> public virtual void Check(Seekers.UNSeeker seeker, Vector3 seekerPos, float seekingDistance, bool isPlaying) { }