Skip to content

Commit

Permalink
Use less derived Collider2D where possible (#35)
Browse files Browse the repository at this point in the history
This has no change in isolation - for a BoxCollider2D x.bounds.size and x.size return the same Vector2.
  • Loading branch information
flibber-hk authored Dec 24, 2021
1 parent a9d4553 commit e7d6605
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions HKMP/Game/Client/PlayerManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using Hkmp.Fsm;
using Hkmp.Game.Client.Skin;
Expand Down Expand Up @@ -201,12 +201,13 @@ byte skinId

// Obtain colliders from both objects
var collider = playerObject.GetComponent<BoxCollider2D>();
var localCollider = localPlayerObject.GetComponent<BoxCollider2D>();
// We're not using the fact that the knight has a BoxCollider as opposed to any other collider
var localCollider = localPlayerObject.GetComponent<Collider2D>();

// Copy collider offset and size
collider.isTrigger = true;
collider.offset = localCollider.offset;
collider.size = localCollider.size;
collider.size = localCollider.bounds.size;
collider.enabled = true;

// Copy collider bounds
Expand Down

0 comments on commit e7d6605

Please sign in to comment.