Browse Source

Entity null checks are rather useless here since GetEntity never returns null

readme
Nico de Poel 5 years ago
parent
commit
2a23096293
  1. 10
      Assets/Scripts/Modules/GameModule.cs

10
Assets/Scripts/Modules/GameModule.cs

@ -16,7 +16,7 @@ public partial class GameModule
{ {
if (string.IsNullOrEmpty(modelName)) if (string.IsNullOrEmpty(modelName))
{ {
uq.GameState.GetEntity(entityNum)?.ClearModel();
uq.GameState.GetEntity(entityNum).ClearModel();
return; return;
} }
@ -41,7 +41,7 @@ public partial class GameModule
if (modelName.EndsWith(".spr")) if (modelName.EndsWith(".spr"))
{ {
// TODO: sprite // TODO: sprite
uq.GameState.GetEntity(entityNum)?.ClearModel();
uq.GameState.GetEntity(entityNum).ClearModel();
return; return;
} }
@ -50,7 +50,7 @@ public partial class GameModule
private void SetEntityTransform(int entityNum, QVec3 origin, QVec3 angles) private void SetEntityTransform(int entityNum, QVec3 origin, QVec3 angles)
{ {
uq.GameState.GetEntity(entityNum)?.SetTransform(origin.ToUnityPosition(), angles.ToUnityRotation());
uq.GameState.GetEntity(entityNum).SetTransform(origin.ToUnityPosition(), angles.ToUnityRotation());
} }
private void RemoveEntity(int entityNum) private void RemoveEntity(int entityNum)
@ -60,11 +60,11 @@ public partial class GameModule
private void UpdateEntityAnimation(int entityNum, int pose1, int pose2, float blend) private void UpdateEntityAnimation(int entityNum, int pose1, int pose2, float blend)
{ {
uq.GameState.GetEntity(entityNum)?.UpdateAnimation(pose1, pose2, blend);
uq.GameState.GetEntity(entityNum).UpdateAnimation(pose1, pose2, blend);
} }
private void SetEntitySkin(int entityNum, int skinNum) private void SetEntitySkin(int entityNum, int skinNum)
{ {
uq.GameState.GetEntity(entityNum)?.SetSkin(skinNum);
uq.GameState.GetEntity(entityNum).SetSkin(skinNum);
} }
} }
Loading…
Cancel
Save