Пример #1
0
        public static void ConstantEvaluator(float[] mapToModify, CombiningMethod combiningMethod, float value = 1f)
        {
            int count = mapToModify.Length;

            for (int i = 0; i < count; i++)
            {
                ContextMap.CombineMapValues(mapToModify, value, i, combiningMethod);
            }
        }
Пример #2
0
 public static void VisualizeMap(float[] mapToVisualize, Vector3 center, Color color, float scale = 1f)
 {
     if (mapToVisualize != null && mapToVisualize.Length > 0)
     {
         int       count      = mapToVisualize.Length;
         Vector3[] directions = ContextMap.GetDiscreteUnitCircleDirections(count);
         for (int i = 0; i < count; i++)
         {
             Debug.DrawLine(center, center + (mapToVisualize [i] * directions [i] * scale), color);
         }
     }
 }
Пример #3
0
        public static void TargetEvaluator(float[] mapToModify, CombiningMethod combiningMethod,
                                           Vector3 origin, Vector3 target)
        {
            int count = mapToModify.Length;

            Vector3[] directions = ContextMap.GetDiscreteUnitCircleDirections(count);
            for (int i = 0; i < count; i++)
            {
                float newVal = Vector3.Dot(directions[i].normalized, (target - origin).normalized);
                newVal = Mathf.Clamp(newVal, 0.3f, 1f);
                ContextMap.CombineMapValues(mapToModify, newVal, i, combiningMethod);
            }
            ContextMap.NormalizeMap(mapToModify);
        }