public void UpdateButtonText() { float magnitude = InfoPool.Request <float>("MousePositionMagnitude"); string magnitudeText = "magnitude: " + (Mathf.RoundToInt(magnitude * 10) / 10f).ToString(); buttonText.text = magnitudeText; Debug.Log(magnitudeText); }
protected override void DefaultAction() { BattlefieldUnits battlefieldUnits = InfoPool.Request <BattlefieldUnits>("Battlefield units"); foreach (UnitController unit in battlefieldUnits.Units) { unit.Health -= 1; } EventPool.Trigger(EventTypes.ActionNoTarget, _avatarController.Player); gameObject.SetActive(false); }
private void OnDisable() { EventPool.StopListening(EventTypes.Move, Move); EventPool.StopListening <Transform>(EventTypes.MoveTo, MoveTo); EventPool.StopListening <bool>(EventTypes.ActionNoTarget, NoTargetAction); EventPool.StopListening <ActionType, UnitController>(EventTypes.ActionEnemyTarget, TargetEnemy); EventPool.StopListening <ActionType, UnitController>(EventTypes.ActionFriendlyTarget, TargetFriend); EventPool.StopListening <ActionType, AvatarController>(EventTypes.ActionFriendlyTargetAvatar, TargetFriend); EventPool.StopListening(EventTypes.Cancel, CancelAction); EventPool.StopListening <UnitController>(EventTypes.Targeted, ExecuteTargetingAction); EventPool.StopListening <UnitController>(EventTypes.UnitDeath, RemoveUnit); InfoPool.Unprovide("Battlefield units", GetBattlefieldUnits); }
protected override void DefaultAction() { BattlefieldUnits battlefieldUnits = InfoPool.Request <BattlefieldUnits>("Battlefield units"); foreach (UnitController unit in battlefieldUnits.UnitsOf(_avatarController.Player)) { UnitController sameStupidUnit = unit; sameStupidUnit.Attack += 1; sameStupidUnit.StatusEffects.Add(new StatusEffect { Type = StatusEffectType.AttackUp, OwnTurns = -1, GlobalTurns = 1, RemoveEffect = delegate { sameStupidUnit.Attack -= 1; } }); } EventPool.Trigger(EventTypes.ActionNoTarget, _avatarController.Player); //gameObject.SetActive(false); }
protected override void DefaultAction() { BattlefieldUnits battlefieldUnits = InfoPool.Request <BattlefieldUnits>("Battlefield units"); foreach (UnitController unit in battlefieldUnits.UnitsOf(_unitController.PlayersArmy)) { UnitController sameStupidUnit = unit; sameStupidUnit.Initiative += Increase; sameStupidUnit.StatusEffects.Add(new StatusEffect { Type = StatusEffectType.Eager, OwnTurns = Duration, GlobalTurns = -1, RemoveEffect = () => sameStupidUnit.Initiative -= Increase }); } EventPool.Trigger(EventTypes.ActionNoTarget, _unitController.PlayersArmy); }
void DisplayUnreadMessages() { var messages = InfoPool.Request <List <Message> >("unread_messages"); MessageCount.text = messages.Count > 9 ? "9+" : messages.Count.ToString(); }
protected override void Start() { base.Start(); _defendBonus = InfoPool.Request <int>("defend bonus"); }
void OnDisable() { EventPool.StopListening <string, string>(EventTypes.MessageArrived, NewMessageArrived); InfoPool.Unprovide("unread_messages", GetUnreadMessages); }
private void OnDisable() { InfoPool.Unprovide <float>("MousePositionMagnitude", GetMousePositionMagnitude); }
private void OnDisable() { InfoPool.Unprovide("defend bonus", GetDefendBonus); }
private void OnEnable() { InfoPool.Provide("defend bonus", GetDefendBonus); }