mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Added Wren scene module ⛏
This commit is contained in:
@@ -2,14 +2,25 @@ class Engine {
|
||||
foreign static Log(msg)
|
||||
}
|
||||
|
||||
class Vector3 {
|
||||
construct new(x, y, z) {
|
||||
_x = x
|
||||
_y = y
|
||||
_z = z
|
||||
class Scene {
|
||||
foreign static GetEntityID(name)
|
||||
|
||||
static GetEntity(name) {
|
||||
var entId = Scene.GetEntityID(name)
|
||||
var ent = Entity.new(entId)
|
||||
return ent
|
||||
}
|
||||
|
||||
foreign static EntityHasComponent(id, name)
|
||||
}
|
||||
|
||||
class Entity {
|
||||
foreign GetComponent(type)
|
||||
}
|
||||
construct new(id) {
|
||||
_entityId = id
|
||||
}
|
||||
|
||||
HasComponent(component) {
|
||||
return Scene.EntityHasComponent(_entityId, component)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import "Scripts/Engine" for Engine
|
||||
import "Scripts/Engine" for Engine, Scene, Entity
|
||||
class Test {
|
||||
init() {
|
||||
System.print("hello init")
|
||||
@@ -13,6 +13,10 @@ class Test {
|
||||
}
|
||||
|
||||
static hello() {
|
||||
Engine.Log("Hello from foreign")
|
||||
var entity = Scene.GetEntity("Trenchbroom map")
|
||||
var hasTransform = entity.HasComponent("Transform")
|
||||
var hasLight = entity.HasComponent("Light")
|
||||
|
||||
Engine.Log("trasnform: %(hasTransform) light:%(hasLight)")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user