private void RPCHandleClientAnimFloat(NetworkUser arg1, ClientAnimatorFloatContainer arg2) { try { arg2.Execute(); } catch (Exception ex) { } }
private void RPCHandleServerAnimFloat(NetworkUser arg1, ClientAnimatorFloatContainer arg2) { try { foreach (var user in NetworkUser.readOnlyInstancesList) { if (arg1 != null) { if (arg1.netId == user.netId) { continue; // skip issuer as it happens client side } } NetClientRequestAnimFloat.Invoke(arg2, user); } } catch (Exception ex) { } }
private float GetAnimationTime(string clipName, float customSpeedScale = 1f) { if (customSpeedScale != 1) { animationSpeedMulti = customSpeedScale; } float attackSpeed = base.characterBody.attackSpeed; float scaledAttackSpeed = ((attackSpeed - 1f) * 0.5f) + 1f; scaledAttackSpeed = Mathf.Min(scaledAttackSpeed, maxAttackSpeed); base.characterDirection.modelAnimator.SetFloat("speedScale", scaledAttackSpeed); netFloatContainer = new ClientAnimatorFloatContainer(); netFloatContainer.animFloat = scaledAttackSpeed; netFloatContainer.animName = "speedScale"; NetServerRequestAnimFloat.Invoke(netFloatContainer, thisUser); float unScaledDuration = base.characterDirection.modelAnimator.runtimeAnimatorController.animationClips.Where(x => x.name.ToLower().Equals(clipName.ToLower())).First().length; return(unScaledDuration / animationSpeedMulti / scaledAttackSpeed); }
public override void OnEnter() { base.OnEnter(); // check if authority if (!base.isAuthority) { return; } #region networking if (isMovingContainer == null) { isMovingContainer = new ClientAnimatorBoolContainer(); isMovingContainer.characterDirection = base.characterDirection.gameObject; isMovingContainer.animName = "isMoving"; } if (isGroundedContainer == null) { isGroundedContainer = new ClientAnimatorBoolContainer(); isGroundedContainer.characterDirection = base.characterDirection.gameObject; isGroundedContainer.animName = "isGrounded"; } if (yVelocityContainer == null) { yVelocityContainer = new ClientAnimatorFloatContainer(); yVelocityContainer.characterDirection = base.characterDirection.gameObject; yVelocityContainer.animName = "yVelocity"; } if (moveSpeedScaleContainer == null) { moveSpeedScaleContainer = new ClientAnimatorFloatContainer(); moveSpeedScaleContainer.characterDirection = base.characterDirection.gameObject; moveSpeedScaleContainer.animName = "moveSpeedScale"; } thisInstance = base.GetComponent <NetworkIdentity>(); thisUser = NetworkUser.readOnlyInstancesList.Where(x => x.netId == thisInstance.netId).FirstOrDefault(); #endregion }