mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
DotNet script changes transform
This commit is contained in:
@@ -1,13 +1,39 @@
|
||||
using System.Diagnostics;
|
||||
using System.Numerics;
|
||||
using DotNetScriptingHelper.Components;
|
||||
|
||||
namespace DotNetScriptingHelper;
|
||||
|
||||
public class TestEntityScript : ScriptableEntity
|
||||
{
|
||||
public int Inty = 1337;
|
||||
private TransformComponent _transform;
|
||||
|
||||
protected override void OnUpdate()
|
||||
public override void OnCreate()
|
||||
{
|
||||
Debug.WriteLine($"My Number is {Inty++}");
|
||||
_transform = GetTransform();
|
||||
}
|
||||
|
||||
protected override void OnUpdate(GameTime gameTime)
|
||||
{
|
||||
float f = (float)Math.Sin(gameTime.TotalSeconds);
|
||||
|
||||
Vector3 pos = _transform.Position;
|
||||
|
||||
pos.Y = f;
|
||||
|
||||
_transform.Position = pos;
|
||||
|
||||
float fx = MathF.Sin(gameTime.TotalSeconds * 2) / 2 + 1;
|
||||
float fy = MathF.Cos(gameTime.TotalSeconds * 2) / 2 + 1;
|
||||
|
||||
Vector3 scl = _transform.Scale;
|
||||
|
||||
scl.X = fx;
|
||||
scl.Y = fy;
|
||||
|
||||
_transform.Scale = scl;
|
||||
|
||||
float fr = MathF.Cos(gameTime.TotalSeconds / 4) * MathF.PI * 10;
|
||||
|
||||
_transform.Rotation = Quaternion.CreateFromYawPitchRoll(0, 0, fr);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user