示例#1
0
    public void SystemSelected(StarSystemController system)
    {
        _systemUI = _systemHUDFactory.Create(system);

        if (_selectedRegiment != null && _regimentJumpable.Contains(system.StarName))
        {
            _selectedRegiment.LocationChange(system.StarName);
            _regimentMovedSignal.Fire(_selectedRegiment.gameObject, system.StarName);
        }

        _selectedRegiment = null;
    }
示例#2
0
    public void Build(bool buildOnServer)
    {
        foreach (Faction fa in Enum.GetValues(typeof(Faction))) // For each house
        {
            if (fa == Faction.None)
            {
                continue;
            }

            TextAsset regimentAsset = Resources.Load(fa + NAME_HouseOOBSuffix) as TextAsset;
            if (regimentAsset == null)
            {
                Debug.Log("WARNING: No regiments found: " + fa.ToString() + NAME_HouseOOBSuffix);
                continue;
            }
            string[] regimentList = regimentAsset.text.Split('\n');

            for (int reg = 0; reg < regimentList.Length; reg++)   // Load all the regiments
            {
                try
                {
                    string[] regimentLine     = regimentList[reg].Split(',');
                    string   regimentName     = regimentLine[0].Trim();
                    int      regimentCount    = (Convert.ToInt32(regimentLine[1]));
                    string   veterency        = regimentLine[2].Trim();
                    string   initialLocation  = regimentLine[3].Trim();
                    string   brigade          = regimentLine[4].Trim();
                    string   regimentInsignia = "";
                    string   brigadeInsignia  = "";

                    if (regimentLine.Length > 5)
                    {
                        regimentInsignia = regimentLine[5].Trim();
                        brigadeInsignia  = regimentLine[6].Trim();
                    }

                    RegimentController newRegiment = _regimentFactory.Create();
                    newRegiment.Setup(regimentName, regimentCount, veterency, initialLocation, brigade, regimentInsignia, brigadeInsignia);
                    newRegiment.GetComponent <FactionController>().CurrentFaction = fa;

                    if (buildOnServer)
                    {
                        NetworkServer.Spawn(newRegiment.gameObject);
                    }
                }
                catch (FormatException ex)
                {
                    Debug.LogError("Could not load regiment" + reg + " (" + ex.Message + ")");
                    continue;
                }
                catch (IndexOutOfRangeException ex)
                {
                    if (reg != regimentList.Length - 1) // Mark keeps adding blank lines at the end
                    {
                        Debug.LogError("Could not load regiment" + reg + " (" + ex.Message + ")");
                        continue;
                    }
                }
            }
        }
    }
示例#3
0
 public void RegimentDeselected(RegimentController regiment)
 {
     //_selectedRegiment = null;
 }
示例#4
0
 public void RegimentSelected(RegimentController regiment, HashSet <string> jumpable)
 {
     _selectedRegiment = regiment;
     _regimentJumpable = jumpable;
 }
 void Construct(RegimentController regiment)
 {
     _regiment = regiment;
 }
 public void DispatchRegimentMoved(RegimentController regiment, string newLocation)
 {
     _regimentMovedSignal.Fire(regiment.gameObject, newLocation);
 }