public void Awake()
        {
            HFTArgParser p = new HFTArgParser();

            bool found = false;
            found |= p.TryGet<string>("instructions", ref instructions);
            found |= p.TryGetBool("bottom", ref bottom);
            if (found)
            {
                show = true;
            }
        }
    void Awake()
    {
        if (s_settings != null)
        {
            throw new System.InvalidProgramException("there is more than one level settings object!");
        }
        s_settings = this;

        HFTArgParser p = new HFTArgParser();
        p.TryGet<int>("hft-numgames", ref numGames);

        m_playerSpawner = GetComponent<PlayerSpawner>();
    }
示例#3
0
    void Awake()
    {
        if (s_settings != null)
        {
            throw new System.InvalidProgramException("there is more than one level settings object!");
        }
        s_settings = this;

        HFTArgParser p = new HFTArgParser();

        p.TryGet <int>("num-games", ref numGames);

        m_playerSpawner = GetComponent <PlayerSpawner>();
    }
示例#4
0
    // Use this for initialization
    void Start()
    {
        HFTArgParser p      = HFTArgParser.GetInstance();
        string       argStr = "";

        if (p.TryGet <string> ("mm-args", ref argStr))
        {
            Deserializer d = new Deserializer();
            m_options = d.Deserialize <Options>(argStr);
        }
        else
        {
            m_options = new Options();
        }

        // This will read command line arguments
        // prefixed with `--mm` for each of the fields
        // in Options so for example `--mm-full-width=1280`
        // It will also except environment variables
        // like `MM_FULL_WIDTH=1280`. If any argument
        // that starts with `-mm` does not match a field
        // it will print an error. Unfortunately
        // there's no way to get those errors back to
        // the OSX/Windows console.
        //
        // camelCaseField is converted to `--mm-camel-case-field`
        // for arguments and `MM_CAMEL_CASE_FIELD` for environment
        // variables.
        if (!HFTArgsToFields.Apply("mm", m_options))
        {
            Debug.Log("could not parse arguments");
        }

        HFTNoPlayers noPlayers = GetComponent <HFTNoPlayers>();

        m_gameServer = noPlayers.GameServer;

        // call HandleFovChange when an fov message arrives
        m_gameServer.RegisterCmdHandler <FovMsg>("fov", HandleFovChange);

        if (!Screen.fullScreen)
        {
            Screen.SetResolution((int)m_options.width, (int)m_options.height, false);
        }

        UpdateCamera();
    }