Example #1
0
 void OnSellTower(FBTower tower)
 {
     SendEvent(FBConsts.E_SellTower, new FBSellTowerArgs()
     {
         Tower = tower
     });
 }
        public override void Execute(object data = null)
        {
            FBUpgradeTowerArgs e     = data as FBUpgradeTowerArgs;
            FBTower            tower = e.Tower;

            tower.Level++;
        }
Example #3
0
 void OnUpgradeTower(FBTower tower)
 {
     SendEvent(FBConsts.E_UpgradeTower, new FBUpgradeTowerArgs()
     {
         Tower = tower
     });
 }
Example #4
0
        public void Show(FBGameModel gm, FBTower tower)
        {
            transform.position = tower.transform.position;

            f_upgradeIcon.Load(gm, tower);
            f_sellIcon.Load(tower);
            gameObject.SetActive(true);
        }
Example #5
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);
        }
Example #6
0
        public override void Execute(object data = null)
        {
            FBSellTowerArgs e     = data as FBSellTowerArgs;
            FBTower         tower = e.Tower;

            //清除Tile存储的信息
            tower.Tile.Data = null;

            //半价出售
            FBGameModel gm = GetModel <FBGameModel>();

            gm.Gold += e.Tower.Price / 2;

            //回收
            FBGame.Instance.ObjectPool.Unspawn(e.Tower.gameObject);
        }
Example #7
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;
        }
Example #8
0
 public void Load(FBTower tower)
 {
     f_tower = tower;
 }