public void SelectUnit()
        {
            RenderUnitRanges.CreateRanges();


            if (SelectionManager.Current.Selection.Ids.Count <= 0)
            {
            }
            else
            {
                UnitInstance Uinst = SelectionManager.Current.AffectedGameObjects[SelectionManager.Current.Selection.Ids[0]].GetComponent <UnitInstance>();

                if (Uinst != null)
                {
                    UnitName.SetValue(Uinst.Owner.Name);
                    SelectedUnitsGroup.text = Uinst.Owner.Parent.Name + " (" + Uinst.Owner.Parent.Owner.Name + ")";

                    UnitStats.text = Uinst.UnitRenderer.BP.CodeName + "\n"
                                     + "Reclaim: Mass: " + (Uinst.UnitRenderer.BP.BuildCostMass * Uinst.UnitRenderer.BP.Wreckage_MassMult)
                                     + ", Energy: " + (Uinst.UnitRenderer.BP.BuildCostEnergy * Uinst.UnitRenderer.BP.Wreckage_EnergyMult)
                                     + "\nVision radius: " + Uinst.UnitRenderer.BP.VisionRadius
                                     + ((Uinst.UnitRenderer.BP.MaxRange > 0) ? ("\nWeapon range: " + Uinst.UnitRenderer.BP.MaxRange) : "");
                    return;
                }
            }


            // Default
            UnitName.SetValue("");
            SelectedUnitsGroup.text = "";
            UnitStats.text          = "";
        }
Пример #2
0
        public void SelectUnit()
        {
            if (SelectionManager.Current.Selection.Ids.Count <= 0)
            {
            }
            else
            {
                UnitInstance Uinst = SelectionManager.Current.AffectedGameObjects[SelectionManager.Current.Selection.Ids[0]].GetComponent <UnitInstance>();

                if (Uinst != null)
                {
                    UnitName.SetValue(Uinst.Owner.Name);
                    SelectedUnitsGroup.text = Uinst.Owner.Parent.Name + " (" + Uinst.Owner.Parent.Owner.Name + ")";
                    return;
                }
            }


            // Default
            UnitName.SetValue("");
            SelectedUnitsGroup.text = "";
        }