public override void ClientDeinitialize(ICharacter character) { if (character.IsCurrentClientCharacter) { // reset game BootstrapperClientGame.Init(null); WindowRespawn.EnsureClosed(); } }
protected override void ClientUpdate(ClientUpdateData data) { var character = data.GameObject; var clientState = data.ClientState; var publicState = data.PublicState; if (!character.IsCurrentClientCharacter) { ClientCharacterEquipmentHelper.ClientRefreshEquipment(character, clientState, publicState); base.ClientUpdate(data); return; } // next code is only for the current client character var privateState = data.PrivateState; if (!publicState.IsDead) { SharedRefreshSelectedHotbarItem(character, privateState); } ClientCharacterEquipmentHelper.ClientRefreshEquipment(character, clientState, publicState); this.ServerRebuildFinalCacheIfNeeded(privateState, publicState); this.SharedApplyInput(character, privateState, publicState); ClientCharacterAnimationHelper.ClientUpdateAnimation( character, clientState, publicState); if (publicState.IsDead) { // dead - stops processing character WindowRespawn.EnsureOpened(); return; } // character is alive - can process its actions WindowRespawn.EnsureClosed(); // update weapon state (fires the weapon if needed) WeaponSystem.SharedUpdateCurrentWeapon(character, privateState.WeaponState, data.DeltaTime); // update current action state (if any) privateState.CurrentActionState?.SharedUpdate(data.DeltaTime); // consumes/restores stamina CharacterStaminaSystem.SharedUpdate(character, publicState, privateState, data.DeltaTime); }
private void ClientInitializeCurrentCharacter(ClientInitializeData data) { var character = data.GameObject; var privateState = data.PrivateState; var publicState = data.PublicState; this.ServerRebuildFinalCacheIfNeeded(privateState, publicState); var sceneObject = character.ClientSceneObject; sceneObject .AddComponent <ComponentPlayerInputUpdater>() .Setup(character); sceneObject .AddComponent <ComponentAmbientSoundManager>(); BootstrapperClientGame.Init(character); // add current public action progress display/watcher sceneObject .AddComponent <ClientComponentActionWithProgressWatcher>() .Setup(privateState); // add skills watcher sceneObject .AddComponent <ClientComponentSkillsWatcher>() .Setup(privateState); // add technologies watcher sceneObject .AddComponent <ClientComponentTechnologiesWatcher>() .Setup(privateState); CurrentCharacterInputHistory.Instance.Clear(); this.CallServer(_ => _.ServerRemote_ResetLastInputAck()); // re-select hotbar slot SharedSelectHotbarSlotId(character, privateState.SelectedHotbarSlotId, isByPlayer: false); WindowRespawn.EnsureClosed(); }