Esempio n. 1
0
        /// <summary>
        ///     The on load.
        /// </summary>
        public void OnLoad()
        {
            this.LocalTeam = new AbilityTeam(GlobalVariables.Team);
            var enemyTeam = new AbilityTeam(GlobalVariables.EnemyTeam)
            {
                OtherTeams = new List <IAbilityTeam> {
                    this.LocalTeam
                }
            };

            this.LocalTeam.OtherTeams.Add(enemyTeam);
            this.Teams = new List <IAbilityTeam> {
                this.LocalTeam, enemyTeam
            };

            // foreach (var unit in ObjectManager.GetEntities<Unit>())
            // {
            // if (!(unit is Hero) || unit.Team == GlobalVariables.EnemyTeam && !(unit is Hero)
            // || unit.ClassId == ClassId.CDOTA_BaseNPC_Creep_Lane
            // || unit.ClassId == ClassId.CDOTA_BaseNPC_Creep_Siege || unit.IsIllusion)
            // {
            // continue;
            // }

            // this.AddUnit(unit);
            // }

            // var delay = Game.GameTime < 0 ? 3000 : 500;
            // DelayAction.Add(
            // delay,
            // () =>
            // {

            // });
            foreach (var hero in Heroes.All)
            {
                this.AddUnit(hero);
            }

            var size = new Vector2((float)(HUDInfo.ScreenSizeX() / 2.3), HUDInfo.ScreenSizeY() / 2);

            this.ui =
                new AbilityManagerUserInterface(
                    new Vector2(HUDInfo.ScreenSizeX() - size.X - 10, (float)(HUDInfo.ScreenSizeY() / 2 - size.Y / 1.5)),
                    size,
                    this);

            this.TeamAdd.Next(this.LocalTeam);
            this.TeamAdd.Next(enemyTeam);
            ObjectManager.OnAddEntity    += this.OnAddEntity;
            ObjectManager.OnRemoveEntity += this.OnRemoveEntity;

            // Game.OnUpdate += this.Game_OnUpdate;
            // Drawing.OnDraw += this.Drawing_OnDraw;
        }
Esempio n. 2
0
        /// <summary>
        ///     The on close.
        /// </summary>
        public void OnClose()
        {
            this.ui.Dispose();
            this.ui = null;

            ObjectManager.OnAddEntity    -= this.OnAddEntity;
            ObjectManager.OnRemoveEntity -= this.OnRemoveEntity;

            // Game.OnUpdate -= this.Game_OnUpdate;
            // Drawing.OnDraw -= this.Drawing_OnDraw;
            this.temporarySkills.Clear();
            this.controllableUnits.Clear();
            this.allies.Clear();
            this.enemies.Clear();
            this.units.Clear();
            this.skills.Clear();
        }
Esempio n. 3
0
        /// <summary>
        ///     The on load.
        /// </summary>
        public void OnLoad()
        {
            this.LocalTeam = new AbilityTeam(GlobalVariables.Team);
            var enemyTeam = new AbilityTeam(GlobalVariables.EnemyTeam)
            {
                OtherTeams = new List <IAbilityTeam> {
                    this.LocalTeam
                }
            };

            this.LocalTeam.OtherTeams.Add(enemyTeam);
            this.Teams = new List <IAbilityTeam> {
                this.LocalTeam, enemyTeam
            };

            // foreach (var unit in ObjectManager.GetEntities<Unit>())
            // {
            // if (!(unit is Hero) || unit.Team == GlobalVariables.EnemyTeam && !(unit is Hero)
            // || unit.ClassId == ClassID.CDOTA_BaseNPC_Creep_Lane
            // || unit.ClassId == ClassID.CDOTA_BaseNPC_Creep_Siege || unit.IsIllusion)
            // {
            // continue;
            // }

            // this.AddUnit(unit);
            // }

            // var delay = Game.GameTime < 0 ? 3000 : 500;
            // DelayAction.Add(
            // delay,
            // () =>
            // {

            // });
            var heroes =
                ObjectManager.GetEntities <Player>()
                .Where(x => x.Hero != null && x.Hero.IsValid)
                .Select(x => x.Hero)
                .ToList();

            foreach (var hero in
                     ObjectManager.GetEntities <Hero>()
                     .Where(hero => !hero.IsIllusion && heroes.All(x => x.Handle != hero.Handle)))
            {
                heroes.Add(hero);
            }

            foreach (var hero in heroes)
            {
                this.AddUnit(hero);
            }

            foreach (var keyValuePair in this.Units)
            {
                foreach (var sourceUnitModifier in keyValuePair.Value.SourceUnit.Modifiers)
                {
                    keyValuePair.Value.Modifiers.AddModifier(sourceUnitModifier);
                }
            }

            // foreach (var hero in heroes)
            // {
            // foreach (var heroModifier in hero.Modifiers)
            // {
            // this.Unit_OnModifierAdded(hero, new ModifierChangedEventArgs(heroModifier));
            // }
            // }
            foreach (var entity in ObjectManager.GetEntities <Unit>())
            {
                if (entity.IsValid && !(entity is Hero) && !(entity is Courier) && entity.Team == this.LocalTeam.Name &&
                    entity.IsControllable)
                {
                    // if (entity.Name == "npc_dota_lone_druid_bear1")
                    // {
                    // Console.WriteLine(entity.GetType());
                    // }
                    // Console.WriteLine(entity.Name);
                    this.AddUnit(entity);
                }
            }

            var size = new Vector2((float)(HUDInfo.ScreenSizeX() / 2.3), HUDInfo.ScreenSizeY() / 2);

            this.ui =
                new AbilityManagerUserInterface(
                    new Vector2(HUDInfo.ScreenSizeX() - size.X - 10, (float)(HUDInfo.ScreenSizeY() / 2 - size.Y / 1.5)),
                    size,
                    this);
            this.TeamAdd.Next(this.LocalTeam);
            this.TeamAdd.Next(enemyTeam);
            ObjectManager.OnAddEntity    += this.OnAddEntity;
            ObjectManager.OnRemoveEntity += this.OnRemoveEntity;

            Unit.OnModifierAdded   += this.Unit_OnModifierAdded;
            Unit.OnModifierRemoved += this.Unit_OnModifierRemoved;

            // Game.OnUpdate += this.Game_OnUpdate;
            // Drawing.OnDraw += this.Drawing_OnDraw;
        }