/// <summary> /// Adds entity to specified stage layer /// </summary> /// <typeparam name="T">Game entity</typeparam> /// <param name="entity">Entity to be added</param> /// <param name="layer">Layer entity should be added to</param> public void AddEntity <T>(T entity, StageLayers layer) { try { entityManager.Add(entity); stages[(int)GameStage.Level].AddTo(layerNames[(int)layer], entity as RenderObject); } catch (Exception e) { Console.WriteLine("Passed entity is not of valid type"); } }
/// <summary> /// Stages entity removal from specifyed layer /// </summary> /// <typeparam name="T">Game entity</typeparam> /// <param name="entity">Entity to be removed</param> /// <param name="layer">Layer entity should be removed from</param> public void RemoveEntity <T>(T entity, StageLayers layer) { //TODO: remove entities from other layers removalQue.Add(entity as RenderObject); }