コード例 #1
0
 public void DisplayOutpostInfo()
 {
     MineInfo.SetActive(false);
     BuildingInfo.SetActive(false);
     UnitInfo.SetActive(false);
     OutpostInfo.SetActive(true);
 }
コード例 #2
0
    private void UpdateSelectedUnitUI()
    {
        if (gc.SelectedObject != null)
        {
            if (ObjectType.text != gc.SelectedObject.GetComponent <ObjectInfo>().ut.ToString())
            {
                ObjectType.text = gc.SelectedObject.GetComponent <ObjectInfo>().ut.ToString();
            }
            if (gc.SelectedObject.GetComponent <ObjectInfo>().ut == UnitTypes.Base)
            {
                MineInfo.SetActive(false);
                BuildingInfo.SetActive(true);
                UnitInfo.SetActive(false);
                OutpostInfo.SetActive(false);
                if (ActionsRemaining.text != gc.SelectedObject.GetComponent <BaseController>().NumberOfActionsRemaining.ToString())
                {
                    ActionsRemaining.text = gc.SelectedObject.GetComponent <BaseController>().NumberOfActionsRemaining.ToString();
                }
            }
            else if (gc.SelectedObject.GetComponent <ObjectInfo>().ut == UnitTypes.Mine)
            {
                MineInfo.SetActive(true);
                BuildingInfo.SetActive(false);
                UnitInfo.SetActive(false);
                OutpostInfo.SetActive(false);
                if (ActionsRemaining.text != "")
                {
                    ActionsRemaining.text = "";
                }
                DisplayMineInfo(gc.SelectedObject.GetComponent <MineHandler>().NumberOfResourcesToAdd, gc.SelectedObject.GetComponent <MineHandler>().UpgradeCost);
            }
            else if (gc.SelectedObject.GetComponent <ObjectInfo>().ut == UnitTypes.Outpost)
            {
                MineInfo.SetActive(false);
                BuildingInfo.SetActive(false);
                UnitInfo.SetActive(false);
                OutpostInfo.SetActive(true);
                if (ActionsRemaining.text != gc.SelectedObject.GetComponent <OutpostHandler>().NumberOfActionsRemaining.ToString())
                {
                    ActionsRemaining.text = gc.SelectedObject.GetComponent <OutpostHandler>().NumberOfActionsRemaining.ToString();
                }
                CostOfMiner.text = gc.SelectedObject.GetComponent <OutpostHandler>().CostOfMiner.ToString();
            }
            else if (gc.SelectedObject.GetComponent <ObjectInfo>().ut == UnitTypes.Soldier ||
                     gc.SelectedObject.GetComponent <ObjectInfo>().ut == UnitTypes.Settler ||
                     gc.SelectedObject.GetComponent <ObjectInfo>().ut == UnitTypes.Miner)
            {
                MineInfo.SetActive(false);
                BuildingInfo.SetActive(false);
                UnitInfo.SetActive(true);
                OutpostInfo.SetActive(false);
                if (ActionsRemaining.text != gc.SelectedObject.GetComponent <UnitBehaviour>().NumberOfActions.ToString())
                {
                    ActionsRemaining.text = gc.SelectedObject.GetComponent <UnitBehaviour>().NumberOfActions.ToString();
                }

                CostToUpgrade.text = gc.SelectedObject.GetComponent <UnitBehaviour>().CostToUpgrade.ToString();
                if (CostForAction.text != gc.SelectedObject.GetComponent <UnitBehaviour>().CostForAction.ToString())
                {
                    CostForAction.text = gc.SelectedObject.GetComponent <UnitBehaviour>().CostForAction.ToString();
                }
            }
        }
    }