Happy_Forest/Assets/Scripts/PilleAuthoring.cs

27 lines
775 B
C#
Raw Normal View History

2026-08-02 21:58:26 +02:00
using Unity.Entities;
using UnityEngine;
using Unity.Mathematics;
namespace HappyForest.Prototypen
{
public class PilleAuthoring : MonoBehaviour
{
public float speed = 5f;
// Der Baker wird von Unity automatisch beim Start ausgeführt
class PilleBaker : Baker<PilleAuthoring>
{
public override void Bake(PilleAuthoring authoring)
{
var entity = GetEntity(TransformUsageFlags.Dynamic);
// Wir fügen der Entity unsere reinen Daten hinzu
AddComponent(entity, new PilleWanderData
{
Speed = authoring.speed,
Direction = new float3(1, 0, 0) // Startrichtung
});
}
}
}
}