static SkillshotDetector()
        {
            return;

            if (!InitComplete)
            {
                InitComplete = true;
                Collision.Init();

                //Detect when the skillshots are created.
                Game.OnProcessPacket           += GameOnOnGameProcessPacket; // Used only for viktor's Laser :^)
                Obj_AI_Base.OnProcessSpellCast += HeroOnProcessSpellCast;

                //Detect when projectiles collide.
                GameObject.OnCreate += SpellMissileOnCreate;
                GameObject.OnDelete += SpellMissileOnDelete;

                GameObject.OnCreate += GameObject_OnCreate;
                GameObject.OnDelete += GameObject_OnDelete;

                // Debug
                if (ObjectManager.Get <Obj_AI_Hero>().Count(h => !h.IsBot) == 1)
                {
                    GameObject.OnCreate += DebugSpellMissileOnCreate;
                    GameObject.OnDelete += DebugSpellMissileOnDelete;
                }

                Console.WriteLine("Skillshot Detector Init");
            }
        }
Example #2
0
        public void Game_OnGameUpdate()
        {
            //Even if it doesnt consume a lot of resources with 20 updatest second works k
            if (SkillshotData.CollisionObjects.Count() > 0 && SkillshotData.CollisionObjects != null &&
                Environment.TickCount - _lastCollisionCalc > 50)
            {
                _lastCollisionCalc = Environment.TickCount;
                _collisionEnd      = Collision.GetCollisionPoint(this);
            }

            //Update the missile position each time the game updates.
            if (SkillshotData.Type == SkillShotType.SkillshotMissileLine)
            {
                Rectangle = new SkillshotGeometry.Rectangle(GetMissilePosition(0), CollisionEnd, SkillshotData.Radius);
                UpdatePolygon();
            }

            //Spells that update to the Caster position.
            if (SkillshotData.MissileFollowsUnit)
            {
                if (Caster.IsVisible)
                {
                    EndPosition = Caster.ServerPosition.To2D();
                    Direction   = (EndPosition - StartPosition).Normalized();
                    UpdatePolygon();
                }
            }
        }