예제 #1
0
 public void GetPathNodeList()
 {
     if (!AppContext.Arrived)
     {
         pathNodeList.Clear();
         OringinGround = map.GroundList[Row * Map.Width + Col];
         AStart();
     }
 }
예제 #2
0
        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();
        }
예제 #3
0
 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);
         }
     }
 }
예제 #4
0
 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;
     }
 }