Example #1
0
    void Update()
    {
        Astronaut.RemoveOxygen(Time.deltaTime);

        AddDisconnects();

        var input = InputSet.Read();

        bool handleInput = true;

        foreach (var d in disconnects)
        {
            handleInput &= !d.StealInput(input);
        }

        if (handleInput)
        {
            Astronaut.Move(input);
        }

        for (int i = 0; i < disconnects.Count; i++)
        {
            if (!disconnects [i].CheckAndUpdate(input))
            {
                disconnects [i].Dispose();
                disconnects.RemoveAt(i--);
            }
        }

        if (Input.GetKeyDown(KeyCode.BackQuote))
        {
            displayConsole = !displayConsole;
        }

        //allow for reset
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Astronaut.ResetState();
            Application.LoadLevel("Splash");
        }
    }