Пример #1
0
        private void OnClientMessage(IPlayer fromPlayer, NetworkAnimationSit networkMessage)
        {
            serverAPI.Logger.Debug("Server: " + fromPlayer.PlayerName + " is sitting: " + networkMessage.isSitting);

            if (networkMessage.isSitting)
            {
                AnimationMetaData data = new AnimationMetaData()
                {
                    Animation = "sitflooridle", Code = "sitflooridle", AnimationSpeed = 1.0f, BlendMode = EnumAnimationBlendMode.Add, SupressDefaultAnimation = true, EaseOutSpeed = 10000, EaseInSpeed = 10000
                }.Init();
                fromPlayer.Entity.AnimManager.StartAnimation(data);
                fromPlayer.Entity.AnimManager.AnimationsDirty = true;
            }
            else
            {
                fromPlayer.Entity.AnimManager.StopAnimation("sitflooridle");
                fromPlayer.Entity.AnimManager.AnimationsDirty = true;
            }

            serverChannel.BroadcastPacket(new NetworkAnimationSit()
            {
                isSitting = networkMessage.isSitting, playerUID = networkMessage.playerUID
            });
        }
Пример #2
0
        private void OnServerMessage(NetworkAnimationSit networkMessage)
        {
            IPlayer sittingPlayer = clientAPI.World.PlayerByUid(networkMessage.playerUID);

            if (sittingPlayer == null)
            {
                return;
            }

            clientAPI.Logger.Debug("Client: " + sittingPlayer.PlayerName + " is sitting: " + networkMessage.isSitting);

            if (networkMessage.isSitting)
            {
                AnimationMetaData data = new AnimationMetaData()
                {
                    Animation = "sitflooridle", Code = "sitflooridle", AnimationSpeed = 1.0f, BlendMode = EnumAnimationBlendMode.Add, SupressDefaultAnimation = true, EaseOutSpeed = 10000, EaseInSpeed = 10000
                }.Init();
                sittingPlayer.Entity.AnimManager.StartAnimation(data);
            }
            else
            {
                sittingPlayer.Entity.AnimManager.StopAnimation("sitflooridle");
            }
        }