protected void _Clear() { FieldUnit.ClearAllUnits(); _fieldController.Clear(); Task.ClearTasks(); GlobalDataHolder.player.ui.Clear(); GlobalDataHolder.Clear(); }
void Awake() { data = this; difficulty = App.difficulty; GlobalEventSystem.OnPlayerLevelUp += LevelUpTimeBonus; GlobalEventSystem.OnLevelEnd += EnforceEnemy; // _time_left = _levelTime; }
public void Start() { Debug.Log("Start level: " + ScenesManager.GetLevelNumber()); _fieldController.Initialize(); GlobalDataHolder.SetField(_fieldController.field); _fieldController.field.SpawnPlayer(); GlobalEventSystem.ListenPlayerDeath(); GlobalEventSystem.RaiseLevelStart(); GlobalDataHolder.player.ui.onGameOverNext += _OnLevelEnd; GlobalDataHolder.player.ui.onGameWin += _OnGameWin; }
public List <Tile> SearchTile(Tile tile, int depth = 10) { if (tile == this) { return new List <Tile>() { this } } ; if (depth == 0) { return(null); } List <Tile> rez = null; List <Tile> tmp = null; if (left != null && left.passable) { rez = left.SearchTile(tile, depth - 1); } if (right != null && right.passable) { tmp = right.SearchTile(tile, depth - 1); if (tmp != null && (rez == null || tmp.Count < rez.Count)) { rez = tmp; } } if (up != null && up.passable) { tmp = up.SearchTile(tile, depth - 1); if (tmp != null && (rez == null || tmp.Count < rez.Count)) { rez = tmp; } } if (down != null && down.passable) { tmp = down.SearchTile(tile, depth - 1); if (tmp != null && (rez == null || tmp.Count < rez.Count)) { rez = tmp; } } if (rez != null) { rez.Add(this); } return(rez); } #region Spawn void SpawnRoutine() { if (UnityEngine.Random.Range(0, 100) <= 15 && spawned_count < GlobalDataHolder.max_units_per_spawn) { Enemy prototype = GlobalDataHolder.FindEnemy(enemy_to_spawn); if (prototype == null) { return; } FieldUnit spawned = prototype.Spawn(random_no_unit_road); if (spawned != null) { GlobalEventSystem.EnemySpawned(spawned); spawned.OnDeath += SpawnedUnitDied; ++spawned_count; } } } int spawned_count = 0; void SpawnedUnitDied(FieldUnit unit) { --spawned_count; }
static SceneManager() { _scenes = new List<IceScene>(); _assemblies = new List<Assembly>(); _globalDataHolder = new GlobalDataHolder(); //LoadAssemblies(); }
public static void Initialize( Player player ) { data = new GlobalDataHolder( player ); }