public void GetPathNodeList() { if (!AppContext.Arrived) { pathNodeList.Clear(); OringinGround = map.GroundList[Row * Map.Width + Col]; AStart(); } }
public Role(string roleImgPath, CCPoint position, CCLayer layer, Map map) { this.map = map; this.layer = layer; Col = (int)position.x; Row = (int)position.y; if (!string.IsNullOrEmpty(roleImgPath)) { Sprite = CCSprite.spriteWithFile(roleImgPath); Sprite.position = new CCPoint(position.x * AppContext.MAP_WIDTH + 15, position.y * AppContext.MAP_WIDTH + 15); layer.addChild(Sprite); } OringinGround = map.GroundList[Row * Map.Width + Col]; GetPathNodeList(); }
public Map(CCLayer layer) { this.layer = layer; GroundBase ground = null; GroundList = new List<GroundBase>(); for (int row = 0; row < Height; row++) { for (int col = 0; col < Width; col++) { ground = new GroundBase(Data[row, col], new CCPoint(col, row), layer); if (ground.Sprite != null) { ground.Sprite.tag = row * Width + col; } GroundList.Add(ground); } } }
public void ChangeToWall(int row, int col) { if (Data[row, col] != 3) { GroundList[row * Width + col] = new GroundBase(3, new CCPoint(col, row), layer); Data[row, col] = 3; } else { if (GroundList[row * Width + col].Sprite != null) { GroundList[row * Width + col].Sprite.removeFromParentAndCleanup(true); } Data[row, col] = 0; GroundList[row * Width + col].GroundType = 0; } }