private void Awake() { AddEnergySub = new Mediator.Subscription(PredefinedMessages.AddEnergy.ToString(), OnAddEnergy); RemoveEnergySub = new Mediator.Subscription(PredefinedMessages.RemoveEnergy.ToString(), OnRemoveEnergy); PerformComboSub = new Mediator.Subscription(PredefinedMessages.PerformCombo.ToString(), OnPerformCombo); }
private void Awake() { m_energyComboChain = GetComponent <ActionEnergyChain>(); AddEnergySub = new Mediator.Subscription(PredefinedMessages.AddEnergy.ToString(), OnAddEnergy); PerformComboSub = new Mediator.Subscription(PredefinedMessages.PerformCombo.ToString(), OnPerformCombo); System.Func <bool> chainIsEmpty = () => { return(m_energyComboChain.ComboChainLength == 0); }; System.Func <bool> chainIsPopulated = () => { return(m_energyComboChain.ComboChainLength > 0); }; System.Func <bool> chainDecayTimeExceeded = () => { return((timeSinceLastAdd += Time.deltaTime) > decayTime); }; System.Func <bool>[] chainIsEmptyCheck = { chainIsEmpty, }; System.Func <bool>[] chainIsIdleCheck = { chainIsPopulated, }; System.Func <bool>[] chainIsDecayingCheck = { chainIsPopulated, chainDecayTimeExceeded, }; System.Action decay = () => { timeSinceLastAdd = 0; Mediator.NotifySubscribers(PredefinedMessages.RemoveEnergy.ToString(), new object[] { 0 }); }; ChainStateMachine.AddTransition(ChainState.Any, ChainState.Empty, chainIsEmptyCheck, null); ChainStateMachine.AddTransition(ChainState.Any, ChainState.Idle, chainIsIdleCheck, null); ChainStateMachine.AddTransition(ChainState.Any, ChainState.Decaying, chainIsDecayingCheck, decay); }
private void Awake() { PerformComboActionSub = new Mediator.Subscription(m_comboActionDefinition.name, PerformComboActionEvent); }