public static void PathFinder (Client C, Path Distance)
{
if (C.Recording)
{
if(Distance to C.Path[C.PathIndex] < 7);
{
if(C.PathIndex + 1< C.Path.Count)
{
C.PathIndex++;
}
else
{
C.Recording = true;
C.Path = new List<Coord>();
C.PathIndex = 0;
C.Path.Add(new Point(C.X, C.Y));
C.Path = C.Path.Reverse();
C.P开发者_开发问答athIndex = 1;
}
Coord To = Calculations.PullWeights(MakeCoord(C.X, C.Y), C.Path[C.PathIndex]);
}
}
}
I am getting several errors, but I`m not sure how to fix the problem. I have looked at solutions but am still a little clueless >.<
This line is wrong
if(Distance to C.Path[C.PathIndex] < 7);
Firstly Distance to C.Path[C.PathIndex]
is not a valid expression. You need to replace it with an expression that does calculate the distance.
Secondly the semi-colon at the end of the line must not be there. You are literally saying if (x) doNothing();
I would assume the error happens here:
if(Distance to C.Path[C.PathIndex] < 7);
This doesn't look like a valid C# expression, and that's what gives you the conversion error
if (C.Recording)
- ifRecording
is not abool
Property, then this won't workif(Distance to C.Path[C.PathIndex] < 7);
this isn't legal C#, and loose the trailing semicolon
Update:
I'm not sure if (!C.Recording)
will work either. I don't know what the type of Recording is. If it's a bool, then it's all fine, but if not, then you need to create a boolean expression.
For instance, if Recording
is a string
type, then you'll need to do
if (!string.IsNullOrEmpty(C.Recording)) { ... }
精彩评论