Пример #1
0
        public override int GetHashCode()
        {
            int hash = Level.GetHashCode();

            if (Description != null)
            {
                hash ^= Description.GetHashCode();
            }
            if (Name != null)
            {
                hash ^= Name.GetHashCode();
            }
            if (Icon != null)
            {
                hash ^= Icon.GetHashCode();
            }
            hash ^= IsHidden.GetHashCode();
            hash ^= IsPassive.GetHashCode();
            hash ^= Cooldown.GetHashCode();
            hash ^= CastingTime.GetHashCode();
            hash ^= ChannelingTime.GetHashCode();
            hash ^= ForceCost.GetHashCode();
            hash ^= EnergyCost.GetHashCode();
            hash ^= ApCost.GetHashCode();
            hash ^= ApType.GetHashCode();
            hash ^= MinRange.GetHashCode();
            hash ^= MaxRange.GetHashCode();
            hash ^= GCD.GetHashCode();
            hash ^= GcdOverride.GetHashCode();
            if (AbilityTokens != null)
            {
                hash ^= AbilityTokens.GetHashCode();
            }
            hash ^= TargetArc.GetHashCode();
            hash ^= TargetArcOffset.GetHashCode();
            hash ^= TargetRule.GetHashCode();
            hash ^= LineOfSightCheck.GetHashCode();
            hash ^= Pushback.GetHashCode();
            hash ^= IgnoreAlacrity.GetHashCode();
            return(hash);
        }
Пример #2
0
        static void Main()
        {
            InitialiseWinForms();

            // Hook 'shell' events into the capturing form.
            Win32.RegisterShellHookWindow(ShellEventsDelegateForm.Handle);


            // TESTING:

            /*Console.WriteLine(DateTime.Now.ToString());
             * using (var gf = new GifWriter(@"W:\work\tmp.gif", new Size(320,240)))
             * {
             *  for (var x = 0; x < 100; x++)
             *  {
             *      gf.WriteScreenFrame(new Point(10+x, 10));
             *  }
             * }
             * Console.WriteLine(DateTime.Now.ToString());// manages about 30fps, almost regardless of capture size (up to a limit)
             */
            // END TEST

            // Hook into system wide windowing events
            using (var winHook = new WindowHookManager())
            {
                using (var switcherForm = new SwitcherForm(winHook))
                    using (var concentrationForm = new ConcentrationForm(winHook))
                        using (var popupWindows = new PopupWindows())
                            using (var pushback = new Pushback())
                                using (var arranger = new WindowArranger())
                                    using (var experimental = new ReferenceWindow(winHook))
                                        using (var hotKeys = new HotkeyCore())
                                        {
                                            // General features
                                            hotKeys.Bind(new[] { Keys.LWin, Keys.Tab }, switcherForm.Toggle);
                                            hotKeys.Bind(new[] { Keys.LShiftKey, Keys.F12 }, concentrationForm.Toggle);
                                            hotKeys.Bind(new[] { Keys.RShiftKey, Keys.F12 }, concentrationForm.Toggle);
                                            hotKeys.Bind(new[] { Keys.LWin, Keys.Space }, popupWindows.ToggleVisibility);
                                            hotKeys.Bind(new[] { Keys.LControlKey, Keys.LWin, Keys.Space }, popupWindows.ToggleFade);
                                            hotKeys.Bind(new[] { Keys.LWin, Keys.Escape }, pushback.PushBackFrontWindow);

                                            // re-arrangement of top-window that breaks less things than the Windows built-in
                                            hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D1 }, arranger.SetTopLeft);
                                            hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D2 }, arranger.SetTop);
                                            hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D3 }, arranger.SetTopRight);
                                            hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D4 }, arranger.SetLeft);
                                            hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D5 }, arranger.SetCentre);
                                            hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D6 }, arranger.SetRight);
                                            hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D7 }, arranger.SetBottomLeft);
                                            hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D8 }, arranger.SetBottom);
                                            hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D9 }, arranger.SetBottomRight);

                                            // win-arrow to move screen
                                            hotKeys.Bind(new[] { Keys.LWin, Keys.Left }, arranger.MoveScreenLeft);
                                            hotKeys.Bind(new[] { Keys.LWin, Keys.Up }, arranger.MoveScreenUp);
                                            hotKeys.Bind(new[] { Keys.LWin, Keys.Right }, arranger.MoveScreenRight);
                                            hotKeys.Bind(new[] { Keys.LWin, Keys.Down }, arranger.MoveScreenDown);

                                            // Reference window
                                            hotKeys.Bind(new[] { Keys.LWin, Keys.OemMinus }, experimental.SetReferenceWindow);

                                            TrayIcon = new NotifyTrayApp("Windows Jedi", Resources.JediIcon, "https://github.com/i-e-b/WindowsJedi");
                                            TrayIcon.AddMenuItem("Settings", delegate { new Settings().ShowDialog(); });
                                            TrayIcon.AddMenuItem("Re-type file", delegate { new FileRetypeChooser().Show(); });
                                            TrayIcon.AddMenuItem("Screen Capture to GIF", delegate { new ScreenCaptureForm().Show(); });

                                            Application.ThreadException += Application_ThreadException;

                                            Application.Run();
                                        }
                ShellEventsDelegateForm.Dispose();
            }
        }
Пример #3
0
    /// <summary>
    /// Handles the cool down.
    /// </summary>
    void HandleCoolDown()
    {
        if (AttackFired && coolDown == 0)
        {
            coolDown = coolDownTime;
            AddTrailComponent();
        }

        if (coolDown > 0)
        {
            //Handle CoolDown Time
            coolDown -= coolDownTimeRate * Time.deltaTime;
            float step             = coolDownTime / bezier.points.Length;
            float cooldowntimeleft = coolDownTime - coolDown;

            //Calculate which point the ray should be cast to, as per it's Cooldown time
            int index = (int)Mathf.Clamp(cooldowntimeleft / step, 0, bezier.points.Length - 1);

            Vector3 targetPosition = bezier.points[index];
            Vector3 direction      = (targetPosition - transform.position);
            float   distance       = Vector3.Distance(targetPosition, transform.position) * attackRange;

            float pointDamage = Damage / bezier.points.Length;

            //Cast a ray to catch the objects within effect distance
            Ray        attackRay = new Ray(transform.position, direction);
            RaycastHit attackHit;
            Physics.Raycast(attackRay, out attackHit, distance, enemyLayers);

            if (attackHit.collider)
            {
                GameObject enemigo = attackHit.collider.gameObject;
                Enemigo    enemy   = enemigo.GetComponent <Enemigo>();
                if (enemy)
                {
                    Salud health = enemigo.GetComponent <Salud>();
                    if (health)
                    {
                        health.TakeDamage(pointDamage);
                    }

                    switch (attackReaction)
                    {
                    case Common.AttackReaction.Juggle:
                        MalabarEnemigo malabarEnemigo = enemigo.GetComponent <MalabarEnemigo>();
                        if (malabarEnemigo)
                        {
                            malabarEnemigo.AddJuggle(pointDamage * attackReactionPower);
                        }
                        break;

                    case Common.AttackReaction.Pushback:
                        Pushback pushback = enemigo.GetComponent <Pushback>();
                        if (pushback)
                        {
                            pushback.AddPushback(pointDamage * attackReactionPower, transform.position);
                        }
                        break;
                    }

                    Debug.Log(attackReaction.ToString());


                    if (cameraShake)
                    {
                        CameraShake.ShakeType ShakeType;
                        switch (attackType)
                        {
                        case Common.MainAttackType.Light:
                            ShakeType = CameraShake.ShakeType.Light;
                            break;

                        case Common.MainAttackType.Medium:
                            ShakeType = CameraShake.ShakeType.Medium;
                            break;

                        case Common.MainAttackType.Fierce:
                            ShakeType = CameraShake.ShakeType.Strong;
                            break;

                        default:
                            ShakeType = CameraShake.ShakeType.Medium;
                            break;
                        }
                        cameraShake.RequestShake(pointDamage, ShakeType);
                    }
                }
            }


            if (DebugAttack)
            {
                Debug.DrawRay(transform.position, direction * attackRange, Color.red);
            }



            ///Create trail effect
            if (trailObject)
            {
                Vector3 trailObjectPosition = attackRay.GetPoint(distance);
                trailObject.transform.position = trailObjectPosition;

                LineRenderer line = trailObject.GetComponent <LineRenderer>();
                line.SetPositions(new Vector3[] {
                    trailObject.transform.position
                    , transform.position
                });
            }
        }

        else
        {
            coolDown    = 0;
            AttackFired = false;
            Destroy(trailObject);
        }
    }