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
transofrm
andspritetransform
are set correctly - Ensure
icecubeprefab
is set to thePrefabs/Objects/icecube
object from the root of the asset tree and set the object's layer to 13 (NoDigGround
) - Add a RigidBody component assigned to
rigid
with the constraints set to freeze rotations - Add an Animator component assigned to
anim
- Initialise
digpart
to an array of 2 new game objects - Assign the
rotater
created earlier by getting the first child of the root - Apply the
Holo
,TIME
andCOT
Modifiers logic as well asShwKEY
andICE
if 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
ccol
and set it's material to the game's default physics material - Set
initialcenter
to theccol
's center andinitialcolliderdata
to (ccol
's height,ccol
's radius) - If the current map is MetalLake, set
overridemovesmoke
to true. If the map'sicemap
is true, theninice
is set to true - Ensure
startpos
is set to the transform's position - Set
spawnpoint
to the transform's position - Unless
noemoticon
is set to true, setup theemoticon
object which is a new object with an Animator namedEmoticon
childed to therotater
, a local position ofemoticonoffset
, and a layer of 15 (3DUI
). Also setemoticonsprite
to a new SpriteRenderer added toemoticon
and set its material to Unity's default sprite material - Ensure an AudioSource is added and assigned to
sound
without playOnAwake - If
startvelocity
is 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
dialoguebleepid
andbleeppitch
respectively. - If
hasshadow
is true, ensure a an object namedshadow
with 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
itemstate
to theanimstate
- Apply the following Modifiers:
Fixed
,FxdCol
,ALW
,ALF
,PAU
,HIDE
,ROT
,ShwEm
,COG
,NGS
when applicable - If the entity has an
npcdata
, also apply the ModifiersITHD
andITAH
when applicable - If we are in a battle and this is the player's entity, ensure
bubbleshield
is created. This will instantiate thePrefabs/Objects/BubbleShield
prefab 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 therotater
and 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 lastpos
is set to thestartpos
assigned earlierinitialheight
is set toheight
- Unless
overrideminheight
is true, theheight
is set tominheight
if the height was smaller than the minimum - Set the sprite's tranform's angles accordingly to whether or not
flip
is set. If it is, it's rotated 180 degrees on the y axis and if it's not, 0 degrees - Set
playerentity
to true only if the tag of the entity isPlayer
orPFollower
.