1[
EntityEditorProps(
category:
"GameLib/Scripted", description:
"Editor comment, for leaving notes in the editor", sizeMin:
"-1 -1 -1", sizeMax:
"1 1 1", visible:
false, dynamicBox:
true)]
20 [
Attribute(
"0",
UIWidgets.CheckBox,
"If true, text is scaled by distance from camera")]
21 bool m_ScaleByDistance;
27 bool m_VisibleOverall;
32 [
Attribute(
"0",
UIWidgets.CheckBox,
"If true, text will have a darkened background plane for easier visibility")]
33 bool m_TextBackground;
36 ref
Color m_BackgroundColor;
39 float m_BackgroundTransparency;
42 private void DrawComment()
44 const float textWidthScale = 0.7;
47 GetWorld().GetCurrentCamera(textMat);
57 if (m_ScaleByDistance)
60 distScale =
Math.Clamp(distScale, 0.5, 10);
63 float textEndSize = (m_Size * distScale) /
vector.Distance(textMat[3],
GetOrigin());
64 if (textEndSize < 0.005)
67 textMat[3] =
GetOrigin() - textMat[1] * m_Size * distScale * 0.5;
71 if (m_Transparency > 0)
75 m_fWB_Width = m_Comment.Length() * m_Size * distScale * textWidthScale;
76 m_fWB_Height = m_Size * distScale;
86 if (m_ScaleByDistance)
91 bgColor =
ARGBF(1 - m_BackgroundTransparency, m_BackgroundColor.R(), m_BackgroundColor.G(), m_BackgroundColor.B());
93 bgColor =
ARGBF(0, 0, 0, 0);
98 float m_fWB_Width = 1;
99 float m_fWB_Height = 1;
105 min =
Vector(m_fWB_Width * -0.5, m_fWB_Height * -0.5, m_fWB_Width * -0.5);
106 max =
Vector(m_fWB_Width * 0.5, m_fWB_Height * 0.5, m_fWB_Width * 0.5);
110 min =
Vector(m_fWB_Width * -0.5, m_fWB_Height * -0.5, m_fWB_Height * 0.25 * -0.5);
111 max =
Vector(m_fWB_Width * 0.5, m_fWB_Height * 0.5, m_fWB_Height * 0.25 * 0.5);
118 return EEntityFrameUpdateSpecs.CALL_WHEN_ENTITY_VISIBLE;
132 if (api.IsEntityLayerVisible(src.GetSubScene(), src.GetLayerID()))
138 override void EOnFrame(
IEntity owner,
float timeSlice)
SCR_EAIThreatSectorFlags flags
RplMode
Mode of replication.
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
event void _WB_GetBoundBox(inout vector min, inout vector max, IEntitySource src)
Editor needs to know a bound box of entity (For ray-casting, visualizers etc.). You can return any cu...
event void _WB_AfterWorldUpdate(float timeSlice)
Called after updating world in Workbench. The entity must be visible in frustum, selected or named....
proto external WorldEditorAPI _WB_GetEditorAPI()
This returns world editor API, which is safe to use from editor events bellow.
event int _WB_GetAfterWorldUpdateSpecs(IEntitySource src)
Called after _WB_OnInit or also later when editor needs to know whether _WB_AfterWorldUpdate needs to...
void IEntity(IEntitySource src, IEntity parent)
protected script Constructor
proto external EntityEvent SetEventMask(EntityEvent e)
proto external vector GetOrigin()
proto external void GetWorldTransform(out vector mat[])
See IEntity::GetTransform.
proto external BaseWorld GetWorld()
proto external vector GetTransformAxis(int axis)
See IEntity::GetTransformAxis.
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
proto native vector Vector(float x, float y, float z)
proto int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.