mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-04-26 10:15:39 -05:00
Fixed Kicked Blocks Not Despawning On Network
This commit is contained in:
parent
522ff7ceb2
commit
a9a444a143
|
|
@ -139,7 +139,21 @@ public class OffenseStateManager : NetworkBehaviour
|
|||
}
|
||||
|
||||
if (collision.transform.CompareTag("destroyable") && myCollider == legHitbox.GetComponent<Collider>()){
|
||||
collision.transform.gameObject.GetComponent<BreakableBlock>().damage(pStats.KickPow);
|
||||
//collision.transform.gameObject.GetComponent<BreakableBlock>().damage(pStats.KickPow);
|
||||
BreakBlockServerRPC(collision.transform.gameObject.GetComponent<NetworkObject>().NetworkObjectId);
|
||||
}
|
||||
}
|
||||
|
||||
[ServerRpc(RequireOwnership = false)]
|
||||
private void BreakBlockServerRPC(ulong NetObjID) {
|
||||
GameObject[] destroyables = GameObject.FindGameObjectsWithTag("destroyable");
|
||||
|
||||
foreach (GameObject destroyable in destroyables) {
|
||||
if (destroyable.GetComponent<NetworkObject>() != null) {
|
||||
if (destroyable.GetComponent<NetworkObject>().NetworkObjectId == NetObjID) {
|
||||
destroyable.GetComponent<NetworkObject>().Despawn(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user