Esempio n. 1
0
 // Use this for initialization
 void Start()
 {
     // Cache the input director
     inputDirector = InputDirector.Get();
     // Set the start time
     startTime = Time.time;
 }
Esempio n. 2
0
 // Use this for initialization
 void Awake()
 {
     inputDirector = InputDirector.Get();
     server = Server.Get();
 }
Esempio n. 3
0
 // Use this for initialization
 void Start()
 {
     playerList = new Dictionary<string, PlayerAttributes>();
     bannedIPAddresses = new Dictionary<string, bool>();
     inputDirector = GetComponent<InputDirector>();
 }
Esempio n. 4
0
    /// <summary>
    /// This message is sent by the Client component in the InputDirector object after the level has been
    /// loaded and all communications with the network game channels have been restored. This is code that
    /// should NOT be occurring in Start() because network communications would still be down at that time.
    /// </summary>
    void OnNetworkLoadedLevel()
    {
        // First off, get our input director. This is in a separate object.
        inputDirector = InputDirector.Get();

        // In a network game, the server set up its instance of the rules, and starts its game here.
        // The client will wait from a buffered message from the server with the game rules enumeration.
        // Then it will start its game.
        if (inputDirector.IsHosting())
        {
            Debug.Log("Game is hot.");
            string gameRules = ConfigurationDirector.GetGameRules();

            // Inform the server and the clients of the game rules. It's important to do it now before
            // any other buffered messages (like spawning AI cycles) happens, or else unpredictable things
            // can happen.
            inputDirector.BroadcastBufferedCommand("OnDefineGameRules", gameRules);
        }
    }