示例#1
0
    void ShowHideStatsBuildButtons()
    {
        // If we updated our selection and only one Entity is left selected,
        if (selection.Count == 1)
        {
            Unit unit = selection[0] as Unit;

            if (unit)
            {
                InitStats(unit);

                // and that entity is a flagship, show build buttons
                Unit_Flagship flag = selection[0].gameObject.GetComponent <Unit_Flagship>();
                if (flag)
                {
                    buildButtonsRoot.SetActive(true);
                }
                else
                {
                    buildButtonsRoot.SetActive(false);
                }
            }
            else
            {
                HideStats();                 // TODO: No support for Entity yet
                buildButtonsRoot.SetActive(false);
            }
        }
        else
        {
            HideStats();             // Nothing is selected, or too much is selected
            buildButtonsRoot.SetActive(false);

            // If we have nothing selected but we are in the middle of build previewing, our flagship was destroyed, so the build must be cancelled
            if (buildState > 0)
            {
                BuildCancel();
            }
        }
    }
示例#2
0
 public void SetFlagship(Unit_Flagship flag)
 {
     flagship = flag;
 }