Exemplo n.º 1
0
        public void Load(FBGameModel game, FBTower tower)
        {
            f_tower = tower;

            FBTowerInfo info = FBGame.Instance.StaticData.GetTower(tower.ID);
            string      path = "Res/Roles/" + (tower.IsTopLevel ? info.NormalIcon : info.DisabledIcon);

            f_render.sprite = Resources.Load <Sprite>(path);
        }
Exemplo n.º 2
0
 public void Show(FBGameModel gm, Vector3 createPosition, bool upSide)
 {
     transform.position = createPosition;
     for (int i = 0; i < f_icons.Length; i++)
     {
         FBTowerInfo info = FBGame.Instance.StaticData.GetTower(i);
         f_icons[i].Load(gm, info, createPosition, upSide);
     }
     gameObject.SetActive(true);
 }
Exemplo n.º 3
0
        public void Load(int towerId, FBGrid grid, Rect mapRect)
        {
            FBTowerInfo info = FBGame.Instance.StaticData.GetTower(towerId);

            ID          = info.ID;
            MaxLevel    = info.MaxLevel;
            BasePrice   = info.BasePrice;
            GuardRange  = info.GuardRange;
            ShotRate    = info.ShotRate;
            UseBulletID = info.UseBulletID;
            Level       = 1;
            f_grid      = grid;
            MapRect     = mapRect;
        }
Exemplo n.º 4
0
        public void Load(FBGameModel game, FBTowerInfo info, Vector3 creatPos, bool upSide)
        {
            f_towerInfo = info;
            f_creatPos  = creatPos;
            //f_enough = game.Gold > info.BasePrice;
            f_enough = true;
            string path = "Res/Roles/" + (f_enough ? info.NormalIcon : info.DisabledIcon);

            f_render.sprite = Resources.Load <Sprite>(path);

            Vector3 pos = transform.localPosition;

            pos.y = upSide ? Mathf.Abs(pos.y) : -Mathf.Abs(pos.y);
            transform.localPosition = pos;
        }
Exemplo n.º 5
0
        private void OnSpawnTower(FBSpawnTowerArgs args)
        {
            //创建Tower
            FBTowerInfo info = FBGame.Instance.StaticData.GetTower(args.TowerID);
            GameObject  go   = FBGame.Instance.ObjectPool.Spawn(info.PrefabName);

            FBTower tower = go.GetComponent <FBTower>();

            tower.transform.position = args.Position;

            //Tile里放入Tower信息
            FBGrid tile = f_map.GetGrid(args.Position);

            ////初始化Tower
            tower.Load(args.TowerID, tile, f_map.MapRect);

            tile.Data = tower;
        }