Beispiel #1
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 &&
                System.Environment.TickCount - _lastCollisionCalc > 50)
            {
                _lastCollisionCalc = System.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();
                }
            }
        }
Beispiel #2
0
        public static void Init()
        {
            if (!InitComplete)
            {
                InitComplete = true;
                Collision.Init();
                //Detect when the skillshots are created.
                Obj_AI_Base.OnProcessSpellCast += HeroOnProcessSpellCast;
                //Game.OnProcessPacket += GameOnOnGameProcessPacket;
                //Detect when projectiles collide.
                OnDetectSkillshot   += OnDetectSkillshotProcessing;
                GameObject.OnCreate += SpellMissileOnCreate;
                GameObject.OnDelete += SpellMissileOnDelete;

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