public override void Tick() { ticks++; if (isNight) { if (ticks >= (DayDurationInTicks / 2)) { ticks = 0; isNight = false; Background.GetComponent <Animation>().Play("night-day", PlayMode.StopAll); dayEffect.gameObject.SetActive(true); nightEffect.gameObject.SetActive(false); enabledEffect = dayEffect; } } else { if (ticks >= (DayDurationInTicks / 2)) { ticks = 0; isNight = true; Background.GetComponent <Animation>().Play("day-night", PlayMode.StopAll); dayEffect.gameObject.SetActive(false); nightEffect.gameObject.SetActive(true); enabledEffect = nightEffect; } } enabledEffect.Trigger(); }
protected override void OnApply(ref CharacterEntity enemyEntity, out Effect effect) { Debug.Log(name + " was applied"); enemyEntity.speed = enemyEntity.baseSpeed * (1 / 3f); enemyEntity.currentBase = color; effect = new OvertimeEffect(name, color, duration); }
public override void Tick() { ticks++; if (ticks >= TriggerIntervalInTicks) { ticks = 0; if (isEventTriggered()) { Event triggeredEvent = getRandomEvent(events); triggeredEvent.gameObject.SetActive(true); StartCoroutine(DisableEvent(triggeredEvent)); UI.OpenEventPanel(triggeredEvent.Title, triggeredEvent.Text); } } foreach (Event ev in GetComponentsInChildren <Event>()) { OvertimeEffect effect = ev.GetComponent <OvertimeEffect>(); if (effect != null) { ev.GetComponent <OvertimeEffect>().Trigger(); } } }
private void Start() { enabledEffect = dayEffect; }