Ejemplo n.º 1
0
        private void OnActivatedAugPressed(object sender, ActivateButtonArgs args)
        {
            if (!args.isPressed) return;

            AbilityButton clickedButton = (AbilityButton)sender;

            if (selectedAug == null)
            {
                selectedAug = clickedButton;
                clickedButton.Activate(true);
                StartBlink(clickedButton.AbilityIndex, true);
                augIndex = clickedButton.AbilityIndex;
            }
            else if (selectedAug == clickedButton)
            {
                clickedButton.Activate(false);
                selectedAug = null;
                StopBlink(clickedButton.AbilityIndex, true);
                augIndex = null;
            }
            else
            {
                // swap
                grid.MoveAugMap(selectedAug.AbilityIndex, clickedButton.AbilityIndex - selectedAug.AbilityIndex);

                // moving to extra
                if (clickedButton.IsExtra)
                {
                    extraAugs[clickedButton.ButtonIndex].Initialize(grid.augmentations[clickedButton.AbilityIndex].name, clickedButton.AbilityIndex, clickedButton.ButtonIndex, true);
                }
                else
                {
                    activeAugs[clickedButton.ButtonIndex].Initialize(grid.augmentations[clickedButton.AbilityIndex].name, clickedButton.AbilityIndex, clickedButton.ButtonIndex, false);
                }

                // moving from extra
                if (selectedAug.IsExtra)
                {
                    extraAugs[selectedAug.ButtonIndex].Initialize(grid.augmentations[selectedAug.AbilityIndex].name, selectedAug.AbilityIndex, selectedAug.ButtonIndex, true);
                }
                else
                {
                    activeAugs[selectedAug.ButtonIndex].Initialize(grid.augmentations[selectedAug.AbilityIndex].name, selectedAug.AbilityIndex, selectedAug.ButtonIndex, false);
                }

                clickedButton.Activate(false);
                selectedAug.Activate(false);

                Deselect(Abilities.Aug);
                StopBlink(clickedButton.AbilityIndex, true);
                augIndex = null;
            }
        }
Ejemplo n.º 2
0
 private void Deselect(Abilities ability)
 {
     if (ability == Abilities.Weapon)
     {
         if (weaponIndex != null)
         {
             StopBlink(weaponIndex.Value, true);
         }
         if (selectedWeapon != null)
         {
             selectedWeapon.Activate(false);
             selectedWeapon = null;
         }
     }
     else
     {
         if (augIndex != null)
         {
             StopBlink(augIndex.Value, true);
         }
         if (selectedAug != null)
         {
             selectedAug.Activate(false);
             selectedAug = null;
         }
     }
 }