Skip to content
This repository was archived by the owner on Oct 20, 2021. It is now read-only.

Commit eeb82d9

Browse files
author
Paul Balaji
authored
Fix exception when shooting health pickups (#220)
1 parent 0ba40d3 commit eeb82d9

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

CHANGELOG.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,24 @@
22

33
## Unreleased
44

5+
### Fixed
6+
7+
- Fixed a bug where shooting a health pickup throws an exception. [#220](https://github.com/spatialos/gdk-for-unity-fps-starter-project/pull/220)
8+
59
## `0.2.5` - 2019-07-18
610

711
### Changed
812

9-
- Changed manifest to use GDK Packages with NPM instead of sideloading.
10-
- Upgraded to GDK for Unity version `0.2.5`
13+
- Changed manifest to use GDK Packages with NPM instead of sideloading. [#211](https://github.com/spatialos/gdk-for-unity-fps-starter-project/pull/211)
14+
- Upgraded to GDK for Unity version `0.2.5`. [#219](https://github.com/spatialos/gdk-for-unity-fps-starter-project/pull/219)
1115

1216
### Internal
1317

14-
- Split the `MobileClient` build into separate `iOS` and `Android` buildkite steps.
18+
- Split the `MobileClient` build into separate `iOS` and `Android` buildkite steps. [#209](https://github.com/spatialos/gdk-for-unity-fps-starter-project/pull/209)
1519

1620
### Fixed
1721

18-
- Fixed a bug where you had to fully uninstall and reinstall a mobile app to swap between local and cloud workflows.
22+
- Fixed a bug where you had to fully uninstall and reinstall a mobile app to swap between local and cloud workflows. [#218](https://github.com/spatialos/gdk-for-unity-fps-starter-project/pull/218)
1923

2024
## `0.2.4` - 2019-06-28
2125

workers/unity/Packages/io.improbable.gdk.guns/Systems/ServerShootingSystem.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using Improbable.Gdk.Core;
22
using Improbable.Gdk.Health;
33
using Unity.Entities;
4-
using UnityEngine;
54

65
namespace Improbable.Gdk.Guns
76
{
@@ -24,6 +23,11 @@ protected override void OnCreate()
2423
protected override void OnUpdate()
2524
{
2625
var events = componentUpdateSystem.GetEventsReceived<ShootingComponent.Shots.Event>();
26+
if (events.Count == 0)
27+
{
28+
return;
29+
}
30+
2731
var gunDataForEntity = GetComponentDataFromEntity<GunComponent.Component>();
2832

2933
for (var i = 0; i < events.Count; ++i)
@@ -41,12 +45,17 @@ protected override void OnUpdate()
4145
continue;
4246
}
4347

48+
if (!gunDataForEntity.Exists(shooterEntity))
49+
{
50+
continue;
51+
}
52+
4453
var gunComponent = gunDataForEntity[shooterEntity];
4554
var damage = GunDictionary.Get(gunComponent.GunId).ShotDamage;
4655

4756
var modifyHealthRequest = new HealthComponent.ModifyHealth.Request(
4857
new EntityId(shotInfo.EntityId),
49-
new HealthModifier()
58+
new HealthModifier
5059
{
5160
Amount = -damage,
5261
Origin = shotInfo.HitOrigin,

0 commit comments

Comments
 (0)