Skip to content

Commit

Permalink
Fixes self-hit when spamclicking (#6864)
Browse files Browse the repository at this point in the history
* Moves hiticons out from player prefabs into SpriteManager.
Hit icons will now be pooled in the SpriteHandlerManager.
Fixes the hiticons being target of interactions, which was making players hit themselves when spamclicking a target.

* Adds the HitIcon prefab to the NetworkManager.
Moves the HitIcon spawn away from the SpriteHandlerManager, it'll now use the Spawn and Despawn classes utilizing their client only functions.
  • Loading branch information
Aranclanos committed Jun 28, 2021
1 parent 20a7d67 commit 1f5d871
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 137 deletions.
124 changes: 14 additions & 110 deletions UnityProject/Assets/Prefabs/Player/Resources/Player_V4(uNet).prefab

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

97 changes: 97 additions & 0 deletions UnityProject/Assets/Prefabs/Player/Resources/hitIcon.prefab

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ public void RpcMeleeAttackLerp(Vector2 stabDir, GameObject weapon)

if (spriteRendererSource != null)
{
playerScript.hitIcon.ShowHitIcon(stabDir, spriteRendererSource);
var projectile = Spawn.ClientPrefab("hitIcon", playerScript.transform.position, playerScript.transform.parent).GameObject;
var hitIcon = projectile.GetComponent<HitIcon>();
hitIcon.ShowHitIcon(stabDir, spriteRendererSource, playerScript);
}

Vector3 lerpFromWorld = spritesObj.transform.position;
Expand Down
Loading

0 comments on commit 1f5d871

Please sign in to comment.