Пример #1
0
        private void ResetPlayer()
        {
            Actor player = Scene.FindActor("Player");

            player.Transform = DefaultPose.Transform;
            Physics.Gravity  = DefaultGravity;
            player.GetScript <PlayerScript>().Reset();
        }
Пример #2
0
        private static void PlayerData(Connection client, NetworkMessage msg)
        {
            Prefab  prefab   = protocol.playerPrefab;
            uint    id       = msg.ReadUInt();
            Vector3 position = msg.ReadVector3();

            Actor actor = PrefabManager.SpawnPrefab(prefab, position);

            actor.Name = $"Player[{id}]";
            Protocol.players.TryAdd(id, actor.GetScript <Player>());

            if (client.GetId() == id)
            {
                protocol.ExecuteAction(() =>
                {
                    var inputManager   = actor.AddScript <InputManager>();
                    inputManager.owner = actor.GetScript <Player>();
                });
            }
        }