public void EventStop(PULSO_Event _e) { if (EventEnd != null) { EventEnd.Invoke(_e); } }
public void FinishEvent() { Player.NormalizeInfluences(); //FIXME - fora de lugar // Subscribe this to an event if (Turn < maxTurns) { StartEvent(); } else { //Finish game List <Player> players = new List <Player>(FindObjectsOfType <Player>()); // Supremacy victory - turns count expired float power1 = players[0].Power.Total(); float power2 = players[1].Power.Total(); if (power1 > power2) { OnGameOver?.Invoke(players[0]); } else { OnGameOver?.Invoke(players[1]); } Debug.Log("Game is finished"); } OnEventEnd?.Invoke(); }
/// <summary> /// Trigger the end of an event and restart the event-tick process /// </summary> private void TriggerEventEnd(RandomEvent _event) { OnEventEnd?.Invoke(_event); SetCurrentEvent(null); isEventOccurring = false; // Reset chance to the lowest possible for starting out with next event currentChance = minChance; }
public void RemoveSpriteEvent(GameTime gameTime) { if (spriteEvent != null) { _StateChanged = true; spriteEvent = null; frameChangeTime = gameTime.TotalGameTime.TotalMilliseconds; sheetPos = 0; spriteEventIndex = -1; sheetSpecification = -1; OnEventEnd.Invoke(this, null); OnEventEnd = null; } }
/// <summary> /// Choose an event to run and then start running it /// </summary> private void TriggerEvent() { isEventOccurring = true; int eventAmount = Random.Range(0, maxChance); foreach (RandomEvent randEvent in events) { if (eventAmount >= 0) { eventAmount -= randEvent.GetChance(); if (eventAmount <= 0) { SetCurrentEvent(randEvent); OnEventEnd?.Invoke(currentEvent); currentEvent.Run(); } } } }
/// <summary> /// Invoke the OnEventEnd event (called in MarkEffectCompleted() if effectsNotCompleted list is empty after an effect has finished) /// </summary> private void InvokeEventEnd() { OnEventEnd?.Invoke(this); }