Exemplo n.º 1
0
    void LoadScenarioShip(Scenario.ShipEntry shipEntry, int layer, Dictionary <GameObject, ScenarioShipData> Container, Color miniMapColor)
    {
        ShipHullData hullData = ResourceManager.instance.GetShipHull(shipEntry.Hull);

        if (hullData != null)
        {
            GameObject newShip = ResourceManager.instance.CreateShip(hullData, shipEntry.Position, shipEntry.Rotation);
            if (newShip != null)
            {
                newShip.transform.GetChild(0).gameObject.layer = layer;
                ScenarioShipData data = new ScenarioShipData(shipEntry.Hull, shipEntry.Design, shipEntry.Name, shipEntry.Level);
                Container.Add(newShip, data);
                PlacedObjects.Add(newShip);
                attachMiniMapObject(newShip, miniMapColor);
            }
        }
    }
Exemplo n.º 2
0
    void SaveScenario()
    {
        Scenario scenario = new Scenario();

        scenario.Name                   = ScenarioName;
        scenario.Description            = ScenarioDescription;
        scenario.Difficulty             = Difficulty;
        scenario.TimeLimit              = TimeLimit;
        scenario.CommandLimit           = CommandLimit;
        scenario.MoneyLimit             = MoneyLimit;
        scenario.DeploymentAreaPosition = DeploymentArea.transform.position;

        foreach (KeyValuePair <GameObject, ScenarioShipData> keyVal in PlayerShips)
        {
            Scenario.ShipEntry shipEntry = new Scenario.ShipEntry(keyVal.Value.DisplayName, keyVal.Value.Hull, keyVal.Value.Design, keyVal.Value.Level, keyVal.Key);
            scenario.PlayerShips.Add(shipEntry);
        }
        foreach (KeyValuePair <GameObject, ScenarioShipData> keyVal in EnemyShips)
        {
            Scenario.ShipEntry shipEntry = new Scenario.ShipEntry(keyVal.Value.DisplayName, keyVal.Value.Hull, keyVal.Value.Design, keyVal.Value.Level, keyVal.Key);
            scenario.EnemyShips.Add(shipEntry);
        }
        foreach (KeyValuePair <GameObject, ScenarioShipData> keyVal in AlliedShips)
        {
            Scenario.ShipEntry shipEntry = new Scenario.ShipEntry(keyVal.Value.DisplayName, keyVal.Value.Hull, keyVal.Value.Design, keyVal.Value.Level, keyVal.Key);
            scenario.AlliedShips.Add(shipEntry);
        }
        foreach (KeyValuePair <GameObject, ScenarioShipData> keyVal in NeutralShips)
        {
            Scenario.ShipEntry shipEntry = new Scenario.ShipEntry(keyVal.Value.DisplayName, keyVal.Value.Hull, keyVal.Value.Design, keyVal.Value.Level, keyVal.Key);
            scenario.NeutralShips.Add(shipEntry);
        }

        //ResourceManager.SaveScenario(scenario);
        BuildScenarioList();
    }