public override float CulcPoint(Vector3 InPoint) { if (TurnOffTest) { return(1); } float Dist = (MyQuery.GetPoint() - InPoint).magnitude; if (Dist < MinDistance) { return(MinMultiplier); } if (MaxDistance > MinDistance && Dist > MaxDistance) { return(MinMultiplier); } if (MyValueGraphic == 0) { return(Multiplier); } float MyMax = MaxDistance > MinDistance ? MaxDistance : MyGenerator.GetMaxDistance(); switch (MyValueGraphic) { case ValueGraphic.UpLinear: { return(MinMultiplier + (Multiplier - MinMultiplier) * (Dist - MinDistance) / (MyMax - MinDistance)); } case ValueGraphic.DownLinear: { return(MinMultiplier + (Multiplier - MinMultiplier) * (MyMax - Dist) / (MyMax - MinDistance)); } default: break; } return(Multiplier); }
public override float CulcPoint(Vector3 InPoint) { if (TurnOffTest) { return(1); } Vector3 MyDestination = MyQuery.GetPoint(); Vector3 MyDirection = MyDestination - InPoint; int MyVis = ForVisibility ? 1 : 0; int MyRay; RaycastHit2D MyRayCast = Physics2D.Raycast(InPoint, MyDirection, MyDirection.magnitude); if (!MyRayCast) { MyRay = 1; } else if (MyQuery.GetTransform() != null) { MyRay = MyRayCast.transform == MyQuery.GetTransform() ? 1 : 0; } else { MyRay = MyRayCast.transform.tag == ForTag ? 1 : 0; } if (MyRay - MyVis != 0) { return(MinMultiplier); } else { return(Multiplier); } }