30 lines
796 B
C#
30 lines
796 B
C#
using System.Numerics;
|
|
using BakeryGame.Components.Common;
|
|
using BakeryGame.Components.Environment;
|
|
using Raylib_cs;
|
|
using Scellecs.Morpeh;
|
|
|
|
namespace BakeryGame.Entities;
|
|
|
|
public class FloorFactory
|
|
{
|
|
private readonly World _world;
|
|
|
|
public FloorFactory(World world)
|
|
{
|
|
_world = world;
|
|
}
|
|
|
|
public Entity CreateFloorBlock(float x, float z, float width, float height)
|
|
{
|
|
var position = new Vector3(x, 0, z);
|
|
var size = new Vector3(width, 0, height);
|
|
|
|
var block = _world.CreateEntity();
|
|
block.SetComponent(new FloorComponent { Size = size });
|
|
block.SetComponent(new ColorComponent { Color = Color.Red });
|
|
block.SetComponent(new PositionComponent(){ Position = position });
|
|
|
|
return block;
|
|
}
|
|
} |