/// <inheritdoc /> protected override void OnEventFired(object source, LocalPlayerSpawnedEventArgs args) { //One local player spawn we want to subscribe the resource updates RecalulateHealthUI(PlayerDetails.EntityData.GetFieldValue <int>((int)EntityObjectField.UNIT_FIELD_HEALTH)); //TODO: Any way to do type inference on generics for Action types??? //We should subscribe to changes in the current health EntityDataCallbackRegister.RegisterCallback <int>(PlayerDetails.LocalPlayerGuid, (int)EntityObjectField.UNIT_FIELD_HEALTH, OnCurrentHealthChangedValue); }
protected void RegisterPlayerDataChangeCallback <TChangeType>(BaseObjectField field, [NotNull] Action <NetworkEntityGuid, EntityDataChangedArgs <TChangeType> > callback) where TChangeType : struct { if (callback == null) { throw new ArgumentNullException(nameof(callback)); } EntityDataCallbackRegister.RegisterCallback(PlayerDetails.LocalPlayerGuid, (int)field, callback); }
protected override void OnEventFired(object source, EntityCreationStartingEventArgs args) { //We're just using the WoW EUnitFields for now, and using display id for the avatar. EntityDataCallbackRegister.RegisterCallback <int>(args.EntityGuid, (int)BaseObjectField.UNIT_FIELD_DISPLAYID, HandleModelChange); }