Exemplo n.º 1
0
        private void SelectPartLinkedUnit()
        {
            PartInfo ActivePartInfo = ListPartInfo[CursorIndexListPart - 1];

            if (InputHelper.InputUpPressed())
            {
                if (CursorIndexListPartUnits > 0)
                {
                    CursorIndexListPartUnits--;
                }
                else
                {
                    CursorIndexListPartUnits = ActivePartInfo.ListUnit.Count;
                }

                UpdatePartsEffects();
            }
            else if (InputHelper.InputDownPressed())
            {
                if (CursorIndexListPartUnits + 1 < ActivePartInfo.ListUnit.Count + 1)
                {
                    CursorIndexListPartUnits++;
                }
                else
                {
                    CursorIndexListPartUnits = 0;
                }

                UpdatePartsEffects();
            }
            else if (InputHelper.InputConfirmPressed())
            {
                Unit LinkedUnit = ActivePartInfo.ListUnit[CursorIndexListPartUnits];
                for (int P = 0; P < LinkedUnit.ArrayParts.Length; ++P)
                {
                    if (LinkedUnit.ArrayParts[P] == ActivePartInfo.ActivePart)
                    {
                        LinkedUnit.ArrayParts[P] = null;
                    }
                }

                SelectedUnit.ArrayParts[CursorIndexUnitPart] = ActivePartInfo.ActivePart;
                ActivePartInfo.ListUnit.Add(SelectedUnit);
                ActivePartInfo.ListUnit.Remove(LinkedUnit);

                SelectedUnit.ResetBoosts();
                SelectedUnit.ActivePassiveBuffs();
                LinkedUnit.ResetBoosts();
                LinkedUnit.ActivePassiveBuffs();
                GoToPartChange();
            }
        }