Exemplo n.º 1
0
    /// <summary>
    /// place a zone using its saved coordinates
    /// </summary>
    /// <param name="targetZone"></param>
    public static void PlaceZone(Zone targetZone)
    {
        GameObject newSpot = Instantiate(instance.zonePrefab, targetZone.CoordsForWorld, Quaternion.identity);

        newSpot.transform.parent = instance.zonesContainer;
        ZoneSpot zsScript = newSpot.GetComponent <ZoneSpot>();

        zsScript.data = targetZone;
        zsScript.RefreshDataDisplay();
    }
Exemplo n.º 2
0
    public static void CreateNewZoneAtPoint(Vector3 point, bool autoOpenEditMenu = true)
    {
        Zone       newZone = new Zone("New Zone", point);
        GameObject newSpot = Instantiate(instance.zonePrefab, point, Quaternion.identity);

        newSpot.transform.parent = instance.zonesContainer;
        ZoneSpot spotScript = newSpot.GetComponent <ZoneSpot>();

        spotScript.data = newZone;
        spotScript.RefreshDataDisplay();

        if (autoOpenEditMenu)
        {
            GameInterface.instance.EditZone(newZone, true);
        }
    }
Exemplo n.º 3
0
    public void CloseAndSaveChanges()
    {
        if (!DataIsValid())
        {
            return;
        }
        CheckIfNameIsAlreadyInUse();
        ZoneSpot mySpot = dataBeingEdited.MyZoneSpot;         //we must get it before applying the new name (we get the spot by name if it's not cached)

        dataBeingEdited.name                   = nameInput.text;
        dataBeingEdited.extraInfo              = eInfoInput.text;
        dataBeingEdited.multTrainingPoints     = float.Parse(multTrainingInput.text, CultureInfo.InvariantCulture);
        dataBeingEdited.multRecruitmentPoints  = float.Parse(multRecruitInput.text, CultureInfo.InvariantCulture);
        dataBeingEdited.multMaxUnitsInGarrison = float.Parse(multMaxGarrInput.text, CultureInfo.InvariantCulture);
        dataBeingEdited.pointsGivenAtGameStart = int.Parse(startPointsInput.text);
        dataBeingEdited.ownerFaction           = GameController.GetFactionIDByName(ownerFactionDropdown.captionText.text);
        dataBeingEdited.UpdateCoordsAccordingToSpotPosition();
        mySpot.RefreshDataDisplay();
        gameObject.SetActive(false);
        OnWindowIsClosing();
    }