public void MakeActionDuration(WorkerAction action, Action onActionFinished) { float duration = GetRandomDurationForAction(action); TickTimer tt = TimeTickSystem.CreateTickTimer((int)Math.Round(duration)); tt.AddTimerFinishedListener(onActionFinished); tt.StartTimer(); }
private static void LoadScene(string sceneName) { Debug.Log("Now loading " + GetCurrentLevelAsString()); TimeTickSystem.ClearDelegates(); ProjectileManager.ResetAllProjectiles(); EnemyManager.ResetAllEnemies(); UpdateEnemyBonusHealth(); SceneManager.LoadScene(sceneName); }
private void Prime() { isPrimed = true; primedTick = TimeTickSystem.GetTick(); spriteRenderer.sprite = primedSprite; //Debug.Log("Primed tick: " + primedTick); }
void Start() { _mirrorCollider = mirrorFront.GetComponent <BoxCollider2D>(); _minXPos = mirrorFront.position.x - (_mirrorCollider.offset.x + _mirrorCollider.size.x / 2) * mirrorFront.localScale.x - DISTANT_FROM_CENTER_TO_SPRITE; _maxXPos = mirrorFront.position.x + (_mirrorCollider.offset.x + _mirrorCollider.size.x / 2) * mirrorFront.localScale.x - DISTANT_FROM_CENTER_TO_SPRITE; _minYPos = mirrorFront.position.y - (_mirrorCollider.offset.y + _mirrorCollider.size.y / 2) * mirrorFront.localScale.y; _maxYPos = mirrorFront.position.y + (_mirrorCollider.offset.y + _mirrorCollider.size.y / 2) * mirrorFront.localScale.y; TimeTickSystem.Create(); TimeTickSystem.onTick += SpawnOnTick; }
private void UpdateActionTimer(int duration) { if (_actionTimer == null) { _actionTimer = TimeTickSystem.CreateTickTimer(duration, false); _actionTimer.AddTimerFinishedListener(OnActionTimer); } else { _actionTimer.RestoreTimer(duration); _actionTimer.PauseTimer(); } }
private void UpdateDelayTimer(int delay) { if (_delayTimer == null) { _delayTimer = TimeTickSystem.CreateTickTimer(delay, false); _delayTimer.AddTimerFinishedListener(OnDelayTimer); } else { _delayTimer.RestoreTimer(delay); _delayTimer.PauseTimer(); } }
private void Awake() { Enemy.whiteFlashMat = enemyWhiteFlashMat; Enemy.deathParticle = enemyDeathParticle; Enemy.spawnParticle = enemySpawnParticle; Enemy.preSpawnParticle = enemyPreSpawnParticle; TimeTickSystem.Create(); if (player != null) { player.InitReferences(); } if (levelHandler != null) { levelHandler.Initialize(); } }
// Start is called before the first frame update void Start() { // move this to main game handler! for when game starts ig //combatClock = new CountdownClock(1, 1); TimeTickSystem.Create(); //clock = new GameLengthClock(); // event handlers for logging ticks if (outputTicksToConsole) { TimeTickSystem.OnTick += delegate(object sender, TimeTickSystem.OnTickEventArgs e) { Debug.Log(e.tick); }; TimeTickSystem.OnTick5 += delegate(object sender, TimeTickSystem.OnTickEventArgs e) { Debug.Log("big tick"); }; } }