7 static ref array<ResourceName> s_Models = {
"{9A85D4C454E19ED7}entities/Props/Crates/Crate_02.et",
"{A0190761A41888C6}entities/Props/Military/AmmoBoxes/AmmoBox_03.et",
"{728DD36004461456}entities/Props/Furniture/Cupboard_01_B.et"};
8 ref SharedItemRef m_World;
9 RenderTargetWidget m_RenderWidget;
16 SetEventMask(EntityEvent.INIT | EntityEvent.FRAME);
21 delete m_RenderWidget;
24 override void EOnInit(IEntity owner)
26 m_World = BaseWorld.CreateWorld(
"Preview",
"Preview");
27 BaseWorld world =
m_World.GetRef();
28 m_RenderWidget = RenderTargetWidget.Cast(
GetGame().GetWorkspace().CreateWidget(WidgetType.RenderTargetWidgetTypeID, WidgetFlags.VISIBLE,
new Color(), 100));
29 FrameSlot.SetOffsets(m_RenderWidget, 0, 0, 0, 0);
30 FrameSlot.SetAnchorMin(m_RenderWidget, 0.1, 0.1);
31 FrameSlot.SetAnchorMax(m_RenderWidget, 0.5, 0.5);
32 m_RenderWidget.Update();
33 m_RenderWidget.SetWorld(world, 0);
36 Resource rsc = Resource.Load(
"{43DA8BEC8468C7F5}worlds/TestMaps/PreviewWorld/PreviewWorld.et");
38 GetGame().SpawnEntityPrefab(rsc, world);
41 world.SetCamera(0,
"0 0.5 -3",
"0 0 0");
42 world.SetCameraType(0, CameraType.PERSPECTIVE);
43 world.SetCameraNearPlane(0, 0.1);
44 world.SetCameraFarPlane(0, 4000);
45 world.SetCameraVerticalFOV(0, 60);
56 Resource rsc = Resource.Load(s_Models[m_ModelIndex]);
59 BaseWorld world =
m_World.GetRef();
60 m_Model =
GetGame().SpawnEntityPrefab(rsc, world);
61 m_Model.SetOrigin(
"0 0 0");
65 if (m_ModelIndex >= s_Models.Count())
69 override void EOnFrame(IEntity owner,
float timeSlice)
71 m_Angle[0] = m_Angle[0] + timeSlice * 30;
72 while (m_Angle[0] > 180.0)
75 m_Angle[0] = m_Angle[0] - 180.0;
78 m_Model.SetYawPitchRoll(m_Angle);