Start¶
EntityControl defines a Start Unity event which performs several important steps. This will be run at the start of the next frame after the creation occurred, but also after being enabled if the entity started disabled:
- Ensure
transofrmandspritetransformare set correctly - Ensure
icecubeprefabis set to thePrefabs/Objects/icecubeobject from the root of the asset tree and set the object's layer to 13 (NoDigGround) - Add a RigidBody component assigned to
rigidwith the constraints set to freeze rotations - Add an Animator component assigned to
anim - Initialise
digpartto an array of 2 new game objects - Assign the
rotatercreated earlier by getting the first child of the root - Apply the
Holo,TIMEandCOTModifiers logic as well asShwKEYandICEif this entity has annpcdata's NPCControl - Calls UpdateSpriteMat which sets the sprite's material to the game's sprite material or the hologram one depending on the value of
hologram - Set the sprite's object's layer to 14 (
Sprite) - Set the sprite to receive shadows
- Ensure there's a CapsuleCollider assigned to
ccoland set it's material to the game's default physics material - Set
initialcenterto theccol's center andinitialcolliderdatato (ccol's height,ccol's radius) - If the current map is MetalLake, set
overridemovesmoketo true. If the map'sicemapis true, theniniceis set to true - Ensure
startposis set to the transform's position - Set
spawnpointto the transform's position - Unless
noemoticonis set to true, setup theemoticonobject which is a new object with an Animator namedEmoticonchilded to therotater, a local position ofemoticonoffset, and a layer of 15 (3DUI). Also setemoticonspriteto a new SpriteRenderer added toemoticonand set its material to Unity's default sprite material - Ensure an AudioSource is added and assigned to
soundwithout playOnAwake - If
startvelocityis set, set therigid's velocity to it - Call CheckSpecialID which loads the EntityValues data
- Set the entity's bleep. For more information on the bleep system, check bleep. The bleep id and pitch are expected to be set beforehand in
dialoguebleepidandbleeppitchrespectively. - If
hasshadowis true, ensure a an object namedshadowwith a SpriteRenderer is created and assigned to the field of the same name and childed to the entity's transform at (0.0, -999.0, 0.0). The transform of the new object is assigned toshadowtransform. The sprite of the shadow is set to the game's shadow sprite with a color of pure white with 40% transparency. The angles of the object are set to (90.0, 0.0, 0.0) and the material's renderQueue is set to 2900 - If the entity is an item entity, assign
itemstateto theanimstate - Apply the following Modifiers:
Fixed,FxdCol,ALW,ALF,PAU,HIDE,ROT,ShwEm,COG,NGSwhen applicable - If the entity has an
npcdata, also apply the ModifiersITHDandITAHwhen applicable - If we are in a battle and this is the player's entity, ensure
bubbleshieldis created. This will instantiate thePrefabs/Objects/BubbleShieldprefab from the root of the asset tree and add a DialogueAnim component to it which grants it the ability to hide using grow/shrink animations. The object is childed to therotaterand it starts shrunk with the shrink speed set to 0.075 and the targetscale when revealed to (1.0, 3.15, 1.0). The object is initially set to have a scale of 0 and a local position of (0.0, 1.25, 0.0). The Renderer of the new object has its color set to full white with 55% transparency and a renderQueue of 2505 lastposis set to thestartposassigned earlierinitialheightis set toheight- Unless
overrideminheightis true, theheightis set tominheightif the height was smaller than the minimum - Set the sprite's tranform's angles accordingly to whether or not
flipis set. If it is, it's rotated 180 degrees on the y axis and if it's not, 0 degrees - Set
playerentityto true only if the tag of the entity isPlayerorPFollower.