/// <summary>
 /// Called when the player tried to cast an ability but was out of mana.
 /// </summary>
 private void OnAbilityCastNoMana()
 {
     CurrentLEDSource = animationModule;
     animationModule.ColorBurst(NoManaColor, 0.3f).ContinueWith((t) =>
     {
         CurrentLEDSource = championModule;
     });
 }
Exemple #2
0
 private void OnChampionKill(Event ev)
 {
     if (ev.KillerName == gameState.ActivePlayer.SummonerName)
     {
         CurrentLEDSource = animationModule;
         if (customKillAnimation != null)
         {
             animationModule.RunAnimationOnce(customKillAnimation, false, 0.1f).ContinueWith((t) =>
             {
                 CurrentLEDSource    = championModule;
                 customKillAnimation = null;
             });
         }
         else
         {
             animationModule.ColorBurst(KillColor, 0.01f).ContinueWith((t) =>
             {
                 CurrentLEDSource = championModule;
             });
         }
     }
 }
        /// <summary>
        /// Called when a change in the scoreboard is detected.
        /// </summary>
        private void GoalDetected(bool leftSide)
        {
            if (leftSide)
            {
                Debug.WriteLine("GOAL! Left side");
            }
            else
            {
                Debug.WriteLine("GOAL! Right side");
            }

            goalOnCooldown = true;

            // Play animation
            animator.ColorBurst(BurstColor, LightZone.All, 1f);
            animator.RunAnimationOnce(GOAL_ANIM_PATH, LightZone.All, 0, false, timeScale: 0.8f);
            animator.ColorBurst(BurstColor, LightZone.All, 2f, false);

            _ = Task.Run(async() =>
            {
                await Task.Delay(GOAL_COOLDOWN_MS);
                goalOnCooldown = false;
            });
        }
Exemple #4
0
        /// <summary>
        /// Called when the mouse is clicked.
        /// </summary>
        private void OnMouseClick(object sender, MouseEventArgs m)
        {
            // TODO: Quick cast support

            if (m.Button == MouseButtons.Right)
            {
                SelectedAbility = AbilityKey.None;
            }
            else if (m.Button == MouseButtons.Left)
            {
                // CODE FOR Q
                if (SelectedAbility == AbilityKey.Q && !qCastInProgress)
                {
                    // Here you should write code to trigger the appropiate animations to play when the user casts Q.
                    // The code will slightly change depending on the champion, since not all champion abilities are cast in the same "Q + Left Click" fashion,
                    // plus you might want to implement custom animation logic for the different champion abilities.

                    // Trigger the start animation.
                    Task.Run(async() =>
                    {
                        await Task.Delay(100);
                        if (!rCastInProgress)
                        {
                            animator.RunAnimationOnce(@"Animations/Vel'Koz/q_start.txt", true);
                        }
                    });

                    // The Q cast is in progress.
                    qCastInProgress = true;

                    // After 1.15s, if user didn't press Q again already, the Q split animation plays.
                    Task.Run(async() =>
                    {
                        await Task.Delay(1150);
                        if (CanCastAbility(AbilityKey.Q) && !rCastInProgress && qCastInProgress)
                        {
                            animator.RunAnimationOnce(@"Animations/Vel'Koz/q_recast.txt");
                            // Since the ability was cast, start the cooldown timer.
                            StartCooldownTimer(AbilityKey.Q);
                        }
                        qCastInProgress = false;
                    });

                    // Q was cast, so now there is no ability selected.
                    // Note that this doesn't get triggered after 1.15s (it doesn't wait for the above task to finish).
                    SelectedAbility = AbilityKey.None;
                }

                // CODE FOR W
                if (SelectedAbility == AbilityKey.W)
                {
                    Task.Run(async() =>
                    {
                        animator.RunAnimationOnce(@"Animations/Vel'Koz/w_cast.txt", true);
                        await Task.Delay(1800);
                        if (!rCastInProgress)
                        {
                            animator.RunAnimationOnce(@"Animations/Vel'Koz/w_close.txt", false, 0.15f);
                        }
                    });
                    StartCooldownTimer(AbilityKey.W);
                    SelectedAbility = AbilityKey.None;
                }

                // CODE FOR E
                if (SelectedAbility == AbilityKey.E)
                {
                    Task.Run(async() =>
                    {
                        await Task.Delay(1000);
                        if (!rCastInProgress)
                        {
                            _ = animator.ColorBurst(HSVColor.FromRGB(229, 115, 255), 0.15f);
                        }
                    });
                    StartCooldownTimer(AbilityKey.E);
                    SelectedAbility = AbilityKey.None;
                }

                // if (SelectedAbility == AbilityKey.R) { } --- Not needed for vel'koz because vel'koz ult is instant cast and doesn't need a mouse click.
            }
        }