Exemplo n.º 1
0
		/// <summary>
		/// Init this instance.
		/// </summary>
		public void Init()
		{
			m_InputManager = new InputManager();
			m_Grid = new Grid();
			m_Grid.Load(GRID_DATA_FILE_NAME);
			m_CollisionDetection = new CollisionDetection(m_Grid);
			SpawnManager spawnManager = new SpawnManager(new ActorFactory(m_InputManager, new PlayerController(m_CollisionDetection), m_CollisionDetection));
			spawnManager.LoadData(SPAWN_DATA_FILE_NAME);
			m_Actors = spawnManager.Spawn(m_Grid);
			m_CollisionDetection.Init(m_Actors);
		}
Exemplo n.º 2
0
		/// <summary>
		/// Spawn actors.
		/// </summary>
		public List<Actor> Spawn(Grid grid)
		{
			List<Actor> result = new List<Actor>();
			foreach (var data in m_Data)
			{
				Actor actor = m_Factory.CreateActor(data.ActorType);
				if (actor != null)
				{
					Cell cell = grid.GetCell(data.X, data.Y);
					if (cell != null)
					{
						actor.Position = cell.Position;
						actor.Init();
						result.Add(actor);
					}
				}
			}
			return result;
		}
Exemplo n.º 3
0
		public CollisionDetection(Grid grid)
		{
			m_Grid = grid;
		}