Inheritance: INotifyPropertyChanged
Example #1
0
        public void UpdateButtonText()
        {
            float  magnitude     = InfoPool.Request <float>("MousePositionMagnitude");
            string magnitudeText = "magnitude: " + (Mathf.RoundToInt(magnitude * 10) / 10f).ToString();

            buttonText.text = magnitudeText;
            Debug.Log(magnitudeText);
        }
Example #2
0
    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);
    }
Example #3
0
 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);
 }
Example #4
0
    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);
    }
Example #5
0
    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);
    }
Example #6
0
    void DisplayUnreadMessages()
    {
        var messages = InfoPool.Request <List <Message> >("unread_messages");

        MessageCount.text = messages.Count > 9 ? "9+" : messages.Count.ToString();
    }
Example #7
0
 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);
 }
Example #9
0
 private void OnDisable()
 {
     InfoPool.Unprovide <float>("MousePositionMagnitude", GetMousePositionMagnitude);
 }
 private void OnDisable()
 {
     InfoPool.Unprovide("defend bonus", GetDefendBonus);
 }
 private void OnEnable()
 {
     InfoPool.Provide("defend bonus", GetDefendBonus);
 }