A short image of what my code does:

And this is my code:
private void CheckObjectAttackPoints(Point AttackPoint){
Point ObjectAttackPoint = AttackPoint;
ObjectAttackPoint.X -= 1;
int count=0;
for (int i=0; i < 1;i++) {
if (GameManager.AllPoints.Contains (ObjectAttackPoint)) {
if (!GameManager.TileColliders [ObjectAttackPoint.X, ObjectAttackPoint.Y].activeSelf) {
count++;
ObjectAttackPoints [i] = ObjectAttackPoint;
Debug.Log (ObjectAttackPoints [i].X +", " + ObjectAttackPoints [i].Y);
}
}
if (i == 1) {
break;
}
ObjectAttackPoint.X += 2;
}
if (count > 0) {
Debug.Log ("Object can attack " + count + " points");
}
}
So, for this method it is required AttackPoint, which already has a value AttackPoint.Y-1, we only need to check if exists AttackPoint.Xin Listand check if the object is active at this point. When the method starts AttackPoint.X, its value decreases by 1.
My problem is that the console returns only one point, even if two tiles are inactive (Image example: 0.0 and 0.2 tiles are inactive, the console returns only count = 1 and a tile with a point of 0.0) this means that the method checks only one plate, and my code has an error, but I can not understand where it is. Can anybody help me?
source
share