コード例 #1
0
    // This spawns the player character and
    // correctly assigns control of it to the connection
    public void Spawn(CustomisationToken token)
    {
        if (!character)
        {
            character = BoltNetwork.Instantiate(BoltPrefabs.Player, token);
        }

        // Server takes control of the char it spawns;
        // client is GIVEN control of the char it spawns.
        if (isServer)
        {
            BoltConsole.Write("Server taking control...");
            character.TakeControl();
        }
        else
        {
            BoltConsole.Write("Assigning control to " + connection);
            character.AssignControl(connection);
        }

        // Just gives a random position.
        character.transform.position = RandomPosition();
    }
コード例 #2
0
 public void LoadCustomisation(CustomisationToken customisation)
 {
     actorStartingFaction = customisation.actorFactionID;
     actorRaceName        = customisation.actorRaceName;
     isPlayer             = true;
 }