public void Update(EntityTeam team, EntityReport report)
        {
            //_report = report;

            if (team.TeamMembers.Length == 0) return;

            var entity = team.TeamMembers[0];

            var cm = Atlas.GetManager<CameraManager>();
            Vector2 v = Vector2.Zero;
            var keys = Atlas.Input;

            v += (keys.IsKeyDown(Keys.Up) ? 1 : 0) * cm.Up
                + (keys.IsKeyDown(Keys.Down) ? -1 : 0) * cm.Up
                + (keys.IsKeyDown(Keys.Right) ? 1 : 0) * cm.Right
                + (keys.IsKeyDown(Keys.Left) ? -1 : 0) * cm.Right;

            entity.TryMove(v);
            entity.TryCrouching(keys.IsKeyDown(Keys.LeftControl));

            foreach (var t in keys.GetTouchCollection())
            {
                v = cm.GetWorldPosition(t.Position, Vector2.One) - entity.Position;
            }

            entity.TryFace((float)Math.Atan2(v.Y, v.X));
        }
 public void DebugDraw(EntityTeam team)
 {
     foreach (var v in subDelegates)
     {
         v.debugDraw();
     }
 }
        public Entity CreateEntity(EntityTeam team, RectangleF[] possibleLocations, Grid.GridTrunk trunk)
        {
            var rand = (int)(possibleLocations.Length * Atlas.Rand);

            return new EntityTypes.HumanEntity(Atlas, team,
                new Vector2(possibleLocations[rand].X + possibleLocations[rand].Width * Atlas.Rand,
                            possibleLocations[rand].Y + possibleLocations[rand].Height * Atlas.Rand));
        }
Exemplo n.º 4
0
        public SeekerEntity(AtlasGlobal atlas, EntityTeam team, Vector2 position)
            : base(atlas, team)
        {
            _radius = 7;
            _angle = 0;

            this._position = position;

            _wantedVelocity = Vector2.Zero;
        }
        public Entity CreateEntity(EntityTeam team, RectangleF[] possibleLocations, Grid.GridTrunk trunk)
        {
            var rand = (int)(possibleLocations.Length * Atlas.Rand);
            for (int i = 0; i < 16; i++)
            {
                    Vector2 point = new Vector2(possibleLocations[rand].X + possibleLocations[rand].Width * Atlas.Rand,
                                possibleLocations[rand].Y + possibleLocations[rand].Height * Atlas.Rand);
                    if (trunk.CanFit(point, 24))
                    return new EntityTypes.VictoryComputerEntity(Atlas, team, point);

            }
            return null;
        }
Exemplo n.º 6
0
 public Entity(AtlasGlobal atlas, EntityTeam team)
     : base(atlas)
 {
     _team = team;
     Id = Guid.NewGuid().ToString();
 }
 public void Update(EntityTeam team, EntityReport report)
 {
 }
        public void Update(EntityTeam entityTeam, EntityReport report)
        {
            ratioX = report.Trunk.Width / WORLD_SPLITS;
            ratioY = report.Trunk.Height / WORLD_SPLITS;

            entityTeam.Color = Color.PeachPuff;
            if (entityTeam.TeamMembers.Length == 0) return;

            foreach (AlekEntitySubDelegate a in subDelegates)
            {
                a.Update(report);
            }
        }
 public void Restart(EntityTeam team)
 {
 }
Exemplo n.º 10
0
        public void HasAdded(EntityTeam team, Entity entity)
        {
            EntityAgent sub = null;

            if (entity is SeekerEntity)
            {
                sub = new SeekerAgent(this, entity);
                _seekers.Add(sub as SeekerAgent);
            }
            else if (entity is HunterEntity)
            {

                sub = new HunterAgent(this, entity);
                //_seekers.Add(sub as HunterAgent);
            }

            if (sub != null)
                _subs.Add(sub);
        }
Exemplo n.º 11
0
        public void DebugDraw(EntityTeam team)
        {
            foreach (var e in team.TeamMembers)
            {
                EntityDebugHelpers.DrawFov(Atlas, e);
            }

            Atlas.Graphics.Flush();
            foreach (var s in _subs)
            {
                s.Draw(Atlas);
            }
            Atlas.Graphics.Flush();
        }
Exemplo n.º 12
0
        public Entity CreateEntity(EntityTeam team, RectangleF[] possibleLocations, Grid.GridTrunk trunk)
        {
            var rand = (int)(possibleLocations.Length * Atlas.Rand);

            for (int i = 0; i < 16; i++ )
            {
                Vector2 point = new Vector2(possibleLocations[rand].X + possibleLocations[rand].Width * Atlas.Rand,
                                            possibleLocations[rand].Y + possibleLocations[rand].Height * Atlas.Rand);

                if(trunk.CanFit(point, 16)) {
                    if (team.TeamMembers.Length % 4 == 1)
                        return new HunterEntity(Atlas, team, point); //spawn a hunter instead, roughly 3 seekers for every hunter
                    return new SeekerEntity(Atlas, team, point);
                }
            }

            return null;
        }
Exemplo n.º 13
0
 public void Restart(EntityTeam team)
 {
     subDelegates.Clear();
 }
Exemplo n.º 14
0
        public void HasAdded(EntityTeam team, Entity entity)
        {
            if (entity is HumanEntity)
            {
                subDelegates.AddLast(new AlekEntitySubDelegate(Atlas, entity, this));

            }
        }
 public void DebugDraw(EntityTeam team)
 {
 }
 public void HasAdded(EntityTeam team, Entity enitity)
 {
 }
Exemplo n.º 17
0
 public void Restart(EntityTeam team)
 {
     _subs.Clear();
     _seekers.Clear();
     FactSheet = new FactSheet(this);
 }
 public bool Swappable(EntityTeam team, EntityDelegate entityDelegate)
 {
     return true;
 }
Exemplo n.º 19
0
        public void Update(EntityTeam team, EntityReport report)
        {
            Team = team;
            Report = report;

            FactSheet.UpdateFactSheet(report);

            foreach (var s in _subs)
            {
                s.Update();
            }
        }
 public VictoryComputerEntity(AtlasGlobal atlas, EntityTeam team, Vector2 position)
     : base(atlas, team)
 {
     this._position = position;
 }
Exemplo n.º 21
0
 public void AddTeam(string key, EntityDelegate teamDelegate)
 {
     var team = new EntityTeam(Atlas, teamDelegate);
     _teams.Add(key, team);
     team.Lock(_key);
 }