Skip to content

Commit ad79aff

Browse files
authored
Feature/Fix anticipation for mage-bolts through walls (#270)
* Fix anticipation for mage-bolts through walls Updates the Anticipation logic for FXProjectileTargetedActionFX so that it can properly anticipate when a mage-bolt is going to slam into a wall. * use var keyword * Handle untargeted mage bolts
1 parent a1764c2 commit ad79aff

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,25 @@ public override void AnticipateAction()
147147
{
148148
base.AnticipateAction();
149149
PlayFireAnim();
150+
151+
// see if this is going to be a "miss" because the player tried to click through a wall. If so,
152+
// we change our data in the same way that the server will (changing our target point to the spot on the wall)
153+
Vector3 targetSpot = Data.Position;
154+
if (Data.TargetIds != null && Data.TargetIds.Length > 0)
155+
{
156+
var targetObj = NetworkSpawnManager.SpawnedObjects[Data.TargetIds[0]];
157+
if (targetObj)
158+
{
159+
targetSpot = targetObj.transform.position;
160+
}
161+
}
162+
163+
if (!ActionUtils.HasLineOfSight(m_Parent.transform.position, targetSpot, out Vector3 collidePos))
164+
{
165+
// we do not have line of sight to the target point. So our target instead becomes the obstruction point
166+
Data.TargetIds = null;
167+
Data.Position = collidePos;
168+
}
150169
}
151170
}
152171
}

0 commit comments

Comments
 (0)