public override void Update() { NameComponent name = Container.GetComponent <NameComponent>(); SpatialComponent spatial = Container.GetComponent <SpatialComponent>(); Console.WriteLine(name.EntityName + " is at: (" + spatial.X + ", " + spatial.Y + ")"); }
/// <summary> /// Constructs an entity with the given identifier. /// </summary> /// <param name="identifier"></param> public Entity(Guid identifier) { Identifier = identifier; Components = new ComponentDictionary(this); Spatial = new SpatialComponent(); Components.Add(Spatial); }
public override void Update() { Console.WriteLine(); Console.WriteLine("-------------------------"); Console.WriteLine(); Console.WriteLine("Which way to move?: WASD"); char direction = Console.ReadKey().KeyChar; SpatialComponent spatial = Container.GetComponent <SpatialComponent>(); switch (direction) { case 'w': spatial.Y += spatial.Speed; break; case 'a': spatial.X -= spatial.Speed; break; case 's': spatial.Y -= spatial.Speed; break; case 'd': spatial.X += spatial.Speed; break; } Console.WriteLine(); Console.WriteLine("_____________________"); Console.WriteLine(" Player Location "); Console.WriteLine("_____________________"); Console.WriteLine(); }
public override void Update() { SpatialComponent spatial = Container.GetComponent <SpatialComponent>(); SpatialComponent spatialPlayer = playerSpace.GetComponent <SpatialComponent>(); if (spatial.X == spatialPlayer.X && spatial.Y == spatialPlayer.Y) { isPlayerAlive = false; } }
public override void Update() { SpatialComponent spatialPowerUp = Container.GetComponent <SpatialComponent>(); SpatialComponent spatialPlayer = playerSpace.GetComponent <SpatialComponent>(); Random x = new Random(); Random y = new Random(); if (spatialPowerUp.X == spatialPlayer.X && spatialPowerUp.Y == spatialPlayer.Y) { Console.WriteLine("Player Teleported!"); spatialPlayer.X = y.Next(-10, 10); spatialPlayer.Y = y.Next(-10, 10); } }
public override void Update() { SpatialComponent spatial = Container.GetComponent <SpatialComponent>(); if (spatial.X > MaxBound) { spatial.X = MaxBound; } if (spatial.X < -1 * MaxBound) { spatial.X = -1 * MaxBound; } if (spatial.Y > MaxBound) { spatial.Y = MaxBound; } if (spatial.Y < -1 * MaxBound) { spatial.Y = -1 * MaxBound; } }
public override void Update() { SpatialComponent spatial = Container.GetComponent <SpatialComponent>(); SpatialComponent spatialPlayer = playerSpace.GetComponent <SpatialComponent>(); if (spatial.X > spatialPlayer.X) { spatial.X -= 1; } else if (spatial.X < spatialPlayer.X) { spatial.X += 1; } else if (spatial.Y > spatialPlayer.Y) { spatial.Y -= 1; } else if (spatial.Y < spatialPlayer.Y) { spatial.Y += 1; } }
public override void Update() { SpatialComponent spatial = Container.GetComponent <SpatialComponent>(); SpatialComponent spatialPlayer = playerSpace.GetComponent <SpatialComponent>(); if (spatial.X == spatialPlayer.X && spatial.Y == spatialPlayer.Y) { Console.WriteLine("Speed Boost Get!"); turn = 6; spatialPlayer.Speed = 2; } if (turn > 0) { turn--; Console.WriteLine(turn + " turns left of boost"); } if (turn == 0) { spatialPlayer.Speed = 1; } }
private void add(SpatialComponent spatial) { spatials_.Add(spatial); }
private void remove(SpatialComponent spatial) { spatials_.Remove(spatial); }
public void AttachTo(IGameEntity entity) { _spatial = (SpatialComponent)entity.GetComponent("Spatial"); OnAttach(); }