Ejemplo n.º 1
0
        private Vector3 GetRandomPoint()
        {
            var directionFromBeast = _gatherer.transform.position - _enemyDetector.GetNearestBeastPosition();

            directionFromBeast.Normalize();

            var endPoint = _gatherer.transform.position + (directionFromBeast * FLEE_DISTANCE);

            if (NavMesh.SamplePosition(endPoint, out var hit, 10f, NavMesh.AllAreas))
            {
                return(hit.position);
            }

            return(_gatherer.transform.position);
        }