예제 #1
0
 private static ActionEnergy[] ConvertArray(ActionEnergy.ActionColorsValues[] m_colorArray)
 {
     ActionEnergy[] arrayClone = new ActionEnergy[m_colorArray.Length];
     for (int i = 0; i < arrayClone.Length; i++)
     {
         arrayClone[i] = m_colorArray[i];
     }
     return(arrayClone);
 }
        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
        }