-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathACustomScript.cs
More file actions
69 lines (57 loc) · 2.01 KB
/
ACustomScript.cs
File metadata and controls
69 lines (57 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System.ComponentModel.DataAnnotations;
using ArchEngine.Core.ECS;
using ArchEngine.Core.Utils;
using ArchEngine.GUI.Editor;
using OpenTK;
using OpenTK.Mathematics;
namespace ArchEngine
{
public class ACustomScript : Script
{
[Inspector] public bool rotateX;
[Inspector] public bool rotateY;
[Inspector] public bool rotateZ;
[Inspector] public float myFloat1;
[Inspector] public float myFloat2;
[Inspector] public Vector3 myVector3;
[Inspector][Range(0, 20)] public int myIntSlider;
[Inspector] public Color4 myColor;
public override void Update() {}
public override void Start() {}
public override void FixedUpdate()
{
//Matrix4 mat = Matrix4.Identity;
//mat = Matrix4.CreateScale( gameObject.Transform.ExtractScale());
//mat *= Matrix4.CreateRotationZ(Runtime.CurrentRuntime);
//mat *= Matrix4.CreateTranslation(gameObject.Transform.ExtractTranslation());
var t = gameObject.Transform;
if (rotateX)
{
t.RotateX(1);
}
if (rotateY)
{
t.RotateY(1);
}
if (rotateZ)
{
t.RotateZ(1);
}
gameObject.Transform = t;
//gameObject.Transform = mat;
myFloat1 = Runtime.CurrentRuntime;
}
}
}
public static class Runtime
{
static Runtime()
{
var ThisProcess = System.Diagnostics.Process.GetCurrentProcess(); LastSystemTime = (long)(System.DateTime.Now - ThisProcess.StartTime).TotalMilliseconds; ThisProcess.Dispose();
StopWatch = new System.Diagnostics.Stopwatch(); StopWatch.Start();
}
private static long LastSystemTime;
private static System.Diagnostics.Stopwatch StopWatch;
//Public.
public static float CurrentRuntime { get { return (StopWatch.ElapsedMilliseconds + LastSystemTime) / 1000f; } }
}