Exemplo n.º 1
0
    // Use this for initialization
    void Awake()
    {
        RegionConfigDataBase _config = null;

        if (GameManager.Instance.ChoosenRegionConfig == null && Override != null)
        {
            _config = Override;
            GameManager.Instance.ChoosenRegionConfig = Override;
        }
        else if (GameManager.Instance.ChoosenRegionConfig != null)
        {
            _config = GameManager.Instance.ChoosenRegionConfig;
        }

        GameObject prefab;

        if (_config != null && _config.IsTutorial)
        {
            prefab = Resources.Load("Regions/worldextender_tutorial") as GameObject;
        }
        else
        {
            prefab = Resources.Load("Regions/worldextender_normal") as GameObject;
        }
        WorldExtender ext = prefab.Instantiate(transform, true).GetComponent <WorldExtender>();

        ext.SetupGame(_config);
    }
Exemplo n.º 2
0
    void CreateRegionConfigs()
    {
        RegionBalancing = ScriptableObject.CreateInstance <RegionConfigDataBase>();

        AssetDatabase.CreateAsset(RegionBalancing, PATH);
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }
Exemplo n.º 3
0
    void LoadRegionConfigs()
    {
        RegionBalancing = (RegionConfigDataBase)AssetDatabase.LoadAssetAtPath(PATH, typeof(RegionConfigDataBase));

        if (RegionBalancing == null)
        {
            CreateRegionConfigs();
        }
    }
Exemplo n.º 4
0
 void OnSelect(RegionConfigDataBase selected)
 {
     if (!selected.IsUnlocked())
     {
         return;
     }
     MDebug.Log("SELECTED REGION " + selected.name);
     selection.Select(selected);
     GameManager.Instance.ChoosenRegionConfig = selected;
 }
Exemplo n.º 5
0
    public override void SetupGame(RegionConfigDataBase region)
    {
        Instance = this;

        RegionBalance = region;
        spawned       = new List <RegionConfig>();
        SetSpawnConfigs(region);
        SpawnNext();
        SpawnNext();
        PlayAmbient();
    }
Exemplo n.º 6
0
    RegionSelecterButton MakeView(RegionConfigDataBase config, Transform target)
    {
        RegionSelecterButton obj = Resources.Load("UI/ui_regionselectionbutton").Instantiate <RegionSelecterButton>(target, true);

        obj.transform.SetParent(target);
        obj.transform.localScale = Vector3.one;

        config.SelectionName = "Mission " + (target.childCount).ToString();
        obj.SetItem(config, OnSelect);

        return(obj);
    }
Exemplo n.º 7
0
    public static void TrackingCall_LevelStart(RegionConfigDataBase region, SquadManager squad, PlayerLevel level)
    {
        Dictionary <string, object> call = new Dictionary <string, object>();

        call["player_level"] = level.GetCurrentLevel();

        call["int"]     = squad.selected_units;
        call["cleared"] = region.IsCompleteInSave().ToString();

        call["editor"] = Application.isEditor.ToString();


        Analytics.CustomEvent("mission_start_" + region.name, call);
    }
Exemplo n.º 8
0
    public static List <RegionConfig> RegionsToSpawn(RegionConfigDataBase config)
    {
        List <RegionConfig> regions_to_spawn = new List <RegionConfig>();

        regions_to_spawn.Add(config.StartRegion);

        foreach (var pool in config.AllPools)
        {
            regions_to_spawn.Add(M_Weightable.GetWeighted(pool.Regions).Region);
        }

        regions_to_spawn.Add(M_Weightable.GetWeighted(config.Camps).Region);

        return(regions_to_spawn);
    }
Exemplo n.º 9
0
    public static void TrackingCall_LevelComplete(RegionConfigDataBase level, MissionOutcome outcome, int player_level)
    {
        Dictionary <string, object> call = new Dictionary <string, object>();

        call["player_level"] = player_level;
        call["supplies"]     = outcome.SuppliesGainedFinal;
        call["evacuated"]    = outcome.SquadUnitsEvaced;
        call["killed"]       = outcome.SquadUnitsKilled;
        call["started"]      = outcome.SquadUnitsStart;

        call["editor"] = Application.isEditor.ToString();


        Analytics.CustomEvent("mission_end_" + level.name, call);
    }
Exemplo n.º 10
0
    public virtual void SetupGame(RegionConfigDataBase Region)
    {
        RegionBalance = Region;
        Instance      = this;

        if (TurnSystem.Instance != null)
        {
            TurnSystem.Instance.OnGlobalTurn += OnGlobalTurn;
        }

        spawned = new List <RegionConfig>();

        SetSpawnConfigs(Region);
        SpawnNext();
        SpawnNext();
        PlayAmbient();
    }
Exemplo n.º 11
0
 protected void SetSpawnConfigs(RegionConfigDataBase Region)
 {
     configsToSpawn = RegionLoader.RegionsToSpawn(Region);
 }
Exemplo n.º 12
0
 public static void SetRegion(RegionConfigDataBase conf)
 {
     //   Instance.ChoosenRegion = conf;
 }
Exemplo n.º 13
0
 private void OnRegionSet(RegionConfigDataBase obj)
 {
     CheckEnabled();
 }
Exemplo n.º 14
0
 void OnSelectedSetView(RegionConfigDataBase selected)
 {
     selecters.GetView(selected).SetSelected();
 }
Exemplo n.º 15
0
 void OnUnSelectedSetView(RegionConfigDataBase unselected)
 {
     selecters.GetView(unselected).SetUnselected();
 }