feat: camera following player
This commit is contained in:
@@ -28,19 +28,7 @@ public class BlockFactory
|
||||
return block;
|
||||
}
|
||||
|
||||
public IEnumerable<Entity> GenerateMapOfBlocks()
|
||||
{
|
||||
for (int x = -16 / 2; x <= 16 / 2; x++) {
|
||||
for (int z = -16 / 2; z <= 16 / 2; z++) {
|
||||
if (x == -16 / 2 || x == 16 / 2 || z == -16 / 2 || z == 16 / 2)
|
||||
{
|
||||
yield return CreateBlock(x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public const float BlockSize = 1;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Numerics;
|
||||
using BakeryGame.Components.Common;
|
||||
using BakeryGame.Components.Player;
|
||||
using BakeryGame.Models;
|
||||
using Raylib_cs;
|
||||
using Scellecs.Morpeh;
|
||||
|
||||
@@ -23,7 +24,7 @@ public class PlayerFactory
|
||||
player.SetComponent(new MovementComponent() { Speed = 0.1f });
|
||||
camera = new CameraComponent()
|
||||
{
|
||||
Camera = new Camera3D(new(0.0f, 10.0f, 10.0f), new(0.0f, 0.0f, 0.0f), new(0.0f, 1.0f, 0.0f), 45.0f, 0)
|
||||
Camera = new CameraRef(new(0.0f, 20.0f, 10.0f), new(0.0f, 0.0f, 0.0f), new(0.0f, 1.0f, 0.0f), 60.0f)
|
||||
};
|
||||
player.SetComponent(camera);
|
||||
|
||||
|
||||
20
Entities/RoomBuilder.cs
Normal file
20
Entities/RoomBuilder.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Scellecs.Morpeh;
|
||||
|
||||
namespace BakeryGame.Entities;
|
||||
|
||||
public class RoomBuilder
|
||||
{
|
||||
public static int RoomSize = 16;
|
||||
|
||||
public static IEnumerable<Entity> GenerateMapOfBlocks(BlockFactory blockFactory)
|
||||
{
|
||||
for (int x = -RoomSize / 2; x <= RoomSize / 2; x++) {
|
||||
for (int z = -RoomSize / 2; z <= RoomSize / 2; z++) {
|
||||
if (x == -RoomSize / 2 || x == RoomSize / 2 || z == -RoomSize / 2 || z == RoomSize / 2)
|
||||
{
|
||||
yield return blockFactory.CreateBlock(x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user