Exemplo n.º 1
0
 public void CloneEnergyComboValues(EnergyComboAction a_energyCombo)
 {
     m_energyComboCode   = a_energyCombo.m_energyComboCode;
     m_actionEnergyValue = a_energyCombo.m_actionEnergyValue;
     name        = a_energyCombo.name;
     m_stability = a_energyCombo.m_stability;
 }
        private void OnPerformCombo(object[] a_args)
        {
            EnergyComboAction nextCombo = m_energyComboChain.NextComboAction;

            if (nextCombo == null)
            {
                return;
            }

            m_lastComboIndex = m_energyComboChain.ComboChainLength - 1;

            for (int i = nextCombo.GetEnergyComboCode().Length; i > 0; i--)
            {
                Mediator.NotifySubscribers(PredefinedMessages.RemoveEnergy.ToString(),
                                           new object[] { m_energyComboChain.ComboChainLength - 1 });
            }

            for (int i = 0; i < nextCombo.GetActionEnergyValue().Length; i++)
            {
                ActionEnergy nextEnergy = nextCombo.GetActionEnergyValue()[i];

                Mediator.NotifySubscribers(PredefinedMessages.AddEnergy.ToString(),
                                           new object[] { nextEnergy });
            }

            decayTime = 1 + nextCombo.Stability * 1.11f;
            Mediator.NotifySubscribers(nextCombo.name, new object[] { nextCombo });


            if (m_lastComboIndex != m_energyComboChain.ComboChainLength - 1)
            {
                //AddEnergySub.Unsubscribe();
                StartCoroutine(ICascadeCombos(nextCombo.Stability));
            }


            // Debugging messages
            ActionEnergy[] actioinValues     = nextCombo.GetActionEnergyValue();
            string         actionColorString = ($"{(actioinValues.Length > 0 ? actioinValues[0].ColorValue.ToString() : "gray")}").ToLower();

            print($"Combo: <color={actionColorString}>{nextCombo.Value}</color> performed");
            // Debugging messages
        }