Exemplo n.º 1
0
        protected virtual void Cmd_RequestRevive()
        {
            bool success = false;

            if (isDead())
            {
                // order is important !
                // *************************************
                reviveCurrentStats();

                PlayerComponent pc = GetComponentInParent <PlayerComponent>();
                pc.WarpLocal(targetAnchor);
                // *************************************

                success = true;
            }


            RpcReviveResponse(success);
        }
        void LoginPlayer_NetworkPortals(NetworkConnection conn, GameObject player, GameObject prefab, string userName, string playerName)
        {
            PlayerComponent     pc          = player.GetComponent <PlayerComponent>();
            string              zoneName    = pc.tablePlayerZones.zonename;
            NetworkZoneTemplate currentZone = pc.currentZone;

            if (!String.IsNullOrWhiteSpace(zoneName) && zoneName != currentZone.name)
            {
                string anchorName = pc.tablePlayerZones.anchorname;
                pc.WarpRemote(anchorName, zoneName);
            }


            // ------- OBSOLETE -------

            /*
             *      // where was the player saved the last time?
             *      string lastScene = Database.singleton.GetCharacterScene(player.name);
             *
             *      if (lastScene != "" && lastScene != SceneManager.GetActiveScene().name)
             *      {
             *              print("[Zones]: " + player.name + " was last saved on another scene, transferring to: " + lastScene);
             *
             *              // ask client to switch server
             *              conn.Send(
             *                      new SwitchServerMsg
             *                      {
             *                              scenePath = lastScene,
             *                              characterName = player.name
             *                      }
             *              );
             *
             *              // immediately destroy so nothing messes with the new
             *              // position and so it's not saved again etc.
             *              NetworkServer.Destroy(player);
             *      }
             */
        }