public void InitializePlugin() { if (Initialized) { return; } // Init foreach (var cloneChamp in ObjectManager.Heroes.Enemies.Where(x => CloneChamps.Contains(x.Hero))) { CloneChampsIngame.Add(cloneChamp); } if (CloneChampsIngame.Count < 1) { Utils.PrintChat("No clone champs ingame"); this.UnloadPlugin(); } Menu = AwarenessEngine.RootMenu.AddSubMenu(Name); Menu.AddSeparator("Coming soon(tm)"); // Event subscriptions Game.OnUpdate += Game_OnUpdate; GameObject.OnCreate += GameObject_OnCreate; Drawing.OnDraw += Drawing_OnDraw; Initialized = true; }
private void GameObject_OnCreate(GameObject sender, EventArgs args) { // Redundant if (CloneChampsIngame.Count <= 0) { return; } if (!sender.IsEnemy) { return; } var obj = sender as Obj_AI_Base; if (obj == null) { return; } if (CloneChampsIngame.Any(cloneChamp => obj.Name == cloneChamp.Name)) { ActiveClones.Add(obj); } }