private void ChFear() { Point antCentre = SupportFunc.getCentre(ThisAnt.Location, ThisAnt.Width, ThisAnt.Height); if (SupportFunc.InRadius(antCentre, Enemy, Visibility)) { IsFear = true; Target = Enemy; TargetLeaf = null; return; } IsFear = false; }
private Control FoundLeaf() { foreach (Control leaf in Leafs) { if (!leaf.Enabled) { continue; } Point antCentre = SupportFunc.getCentre(ThisAnt.Location, ThisAnt.Width, ThisAnt.Height); Point leafCentre = SupportFunc.getCentre(leaf.Location, leaf.Width, leaf.Height); if (SupportFunc.InRadius(antCentre, leafCentre, Visibility)) { return(leaf); } } return(null); }