/// <summary> /// Adds a new component to this level /// </summary> /// <param name="type">The type of the component</param> /// <param name="x">The x position of the component</param> /// <param name="y">The y position of the component</param> /// <param name="angle">The rotation angle of the component</param> /// <returns></returns> public LevelComponent Add(LevelComponentType type, float x, float y, float angle) { Vector2 pos = new Vector2(x, y); LevelComponent component = null; switch (type) { case LevelComponentType.grass: component = new Ground(world, content, pos, angle, 400, 60); break; case LevelComponentType.jump: component = new Jump(world, content, pos, angle, 150, 85); break; case LevelComponentType.nail: component = new SpikeMat(world, content, pos, angle, 250, 70); break; case LevelComponentType.finish: component = new Finish(world, content, pos, angle, 100, 200); break; } if (component != null) { components.Add(component); } return(component); }
/// <summary> /// Adds a new component to this level /// </summary> /// <param name="type">The type of the component</param> /// <param name="x">The x position of the component</param> /// <param name="y">The y position of the component</param> /// <param name="angle">The rotation angle of the component</param> /// <returns></returns> public LevelComponent Add(LevelComponentType type, float x, float y, float angle) { Vector2 pos = new Vector2(x, y); LevelComponent component = null; switch (type) { case LevelComponentType.grass: component = new Ground(world, content, pos, angle, 400, 60); break; case LevelComponentType.jump: component = new Jump(world, content, pos, angle, 150, 85); break; case LevelComponentType.nail: component = new SpikeMat(world, content, pos, angle, 250, 70); break; case LevelComponentType.finish: component = new Finish(world, content, pos, angle, 100, 200); break; } if (component != null) components.Add(component); return component; }