Skip to content

Commit a2a3886

Browse files
authored
fixing charged arrow NRE, mage FX codestyle feedback, and an issue with imps leaking out of the scene. (#323)
1 parent 602b2d4 commit a2a3886

File tree

4 files changed

+6
-27
lines changed

4 files changed

+6
-27
lines changed

Assets/BossRoom/Scripts/Client/Game/Action/ChargedLaunchProjectileActionFX.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public ChargedLaunchProjectileActionFX(ref ActionRequestData data, ClientCharact
2121
/// (like mobile devices), it can lead to major performance problems. On mobile platforms, visual graphics should
2222
/// use object-pooling (i.e. reusing the same GameObjects repeatedly). But that's outside the scope of this demo.
2323
/// </remarks>
24-
private List<SpecialFXGraphic> m_Graphics;
24+
private List<SpecialFXGraphic> m_Graphics = new List<SpecialFXGraphic>();
2525

2626
private bool m_ChargeEnded;
2727

Assets/BossRoom/Scripts/Client/Game/Action/FXProjectileTargetedActionFX.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public override bool Update()
5151
if (TimeRunning >= Description.ExecTimeSeconds && m_Projectile == null)
5252
{
5353
// figure out how long the pretend-projectile will be flying to the target
54-
Vector3 targetPos = m_Target ? m_Target.transform.position : m_Data.Position;
55-
float initialDistance = Vector3.Distance(targetPos, m_Parent.transform.position);
54+
var targetPos = m_Target ? m_Target.transform.position : m_Data.Position;
55+
var initialDistance = Vector3.Distance(targetPos, m_Parent.transform.position);
5656
m_ProjectileDuration = initialDistance / Description.Projectiles[0].Speed_m_s;
5757

5858
// create the projectile. It will control itself from here on out
@@ -63,11 +63,6 @@ public override bool Update()
6363
return TimeRunning <= m_ProjectileDuration + Description.ExecTimeSeconds;
6464
}
6565

66-
public override void OnAnimEvent(string id)
67-
{
68-
//Debug.Log($"Anim event: {id}");
69-
}
70-
7166
public override void Cancel()
7267
{
7368
if (m_Projectile)
@@ -133,9 +128,9 @@ private bool IsParentAnNPC()
133128

134129
private FXProjectile SpawnAndInitializeProjectile()
135130
{
136-
GameObject projectileGO = Object.Instantiate(Description.Projectiles[0].ProjectilePrefab, m_Parent.transform.position, m_Parent.transform.rotation, null);
131+
var projectileGO = Object.Instantiate(Description.Projectiles[0].ProjectilePrefab, m_Parent.transform.position, m_Parent.transform.rotation, null);
137132

138-
FXProjectile projectile = projectileGO.GetComponent<FXProjectile>();
133+
var projectile = projectileGO.GetComponent<FXProjectile>();
139134
if (!projectile)
140135
{
141136
throw new System.Exception($"FXProjectileTargetedAction tried to spawn projectile {projectileGO.name}, as dictated for action type {Data.ActionTypeEnum}, but the object doesn't have a FXProjectile component!");

Assets/BossRoom/Scripts/Server/Game/Entity/ServerWaveSpawner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ NetworkObject SpawnPrefab()
227227
var clone = Instantiate(m_NetworkedPrefab, m_SpawnPositions[posIdx].position, m_SpawnPositions[posIdx].rotation);
228228
if (!clone.IsSpawned)
229229
{
230-
clone.Spawn();
230+
clone.Spawn(null, true);
231231
}
232232

233233
if (m_SpawnedEntityDetectDistance > -1)

Assets/BossRoom/Scripts/Shared/Game/Action/ActionRequestData.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,6 @@ public enum ActionLogic
6060
//O__O adding a new ActionLogic branch? Update Action.MakeAction!
6161
}
6262

63-
/// <summary>
64-
/// Retrieves static information about ActionLogics
65-
/// </summary>
66-
public static class ActionLogicUtils
67-
{
68-
/// <summary>
69-
/// When requesting an action with this type of ActionLogic, do we need to store the Position where player clicked?
70-
/// (We separate this out so that we don't need to send the extra Vector3 across the network if unneeded.)
71-
/// </summary>
72-
public static bool IsPositionUsed(ActionLogic logic)
73-
{
74-
return logic == ActionLogic.RangedFXTargeted;
75-
}
76-
77-
}
7863

7964
/// <summary>
8065
/// Comprehensive class that contains information needed to play back any action on the server. This is what gets sent client->server when
@@ -179,4 +164,3 @@ public void NetworkSerialize(NetworkSerializer serializer)
179164
}
180165
}
181166
}
182-

0 commit comments

Comments
 (0)