示例#1
0
 void OnBuyBuildingEvent(BuyBuildingEvent e)
 {
     if (e.Building == this)
     {
         SetState(BuildingState.Owned);
     }
 }
示例#2
0
    void PlayerBuild(Player player, Grid grid)
    {
        if (player == null)
        {
            Debug.LogError("no player");
            return;
        }
        BuyBuildingEvent _buyBuildEvent = new BuyBuildingEvent();

        _buyBuildEvent.buyers  = player;
        _buyBuildEvent.setGrid = grid;

        GUIController.Instance.ShowBuyUI(_buyBuildEvent);
    }
示例#3
0
    public void Build(BuyBuildingEvent buildEvent)
    {
        if (buildEvent == null)
        {
            return;
        }

        if (buildingPrfab != null)
        {
            GameObject _go = Instantiate(buildingPrfab) as GameObject;
            _go.transform.SetParent(bornParent);
            Building _building = _go.GetComponent <Building> ();
            buildEvent.item = _building;
            _building.InitBuilding(buildEvent.buyers, buildEvent.setGrid);
        }
    }
示例#4
0
    public void Apply()
    {
        if (getBuyEvent == null)
        {
            return;
        }

        if (selectBuyGroup != null)
        {
            foreach (var toggle in selectBuyGroup.GetComponentsInChildren <Toggle>())
            {
                if (toggle.isOn)
                {
                    if (getBuyEvent is BuyBuildingEvent)
                    {
                        BuildingItemUI   _buildItemUI = toggle.GetComponent <BuildingItemUI> ();
                        BuyBuildingEvent _buildEvent  = getBuyEvent as BuyBuildingEvent;
                        _buildItemUI.Build(_buildEvent);
                    }
                    JobDone();
                }
            }
        }
    }
示例#5
0
 void OnBuyBuildingEvent(BuyBuildingEvent e)
 {
     wealth -= e.Building.Value;
     buildings.Add(e.Building);
 }