コード例 #1
0
ファイル: Role.cs プロジェクト: hj458377603/TowerDefence
 public void GetPathNodeList()
 {
     if (!AppContext.Arrived)
     {
         pathNodeList.Clear();
         OringinGround = map.GroundList[Row * Map.Width + Col];
         AStart();
     }
 }
コード例 #2
0
ファイル: Role.cs プロジェクト: hj458377603/TowerDefence
        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
ファイル: Map.cs プロジェクト: hj458377603/TowerDefence
 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
ファイル: Map.cs プロジェクト: hj458377603/TowerDefence
 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;
     }
 }