Пример #1
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);

            graphics.PreferredBackBufferWidth  = 853;
            graphics.PreferredBackBufferHeight = 480;

            Content.RootDirectory = "Content";

            //Initialise Input Service
            inputState = new InputState(this);
            Services.AddService(typeof(InputState), inputState);

            //Initialise fizzyo Service
            fizzyo = new FizzyoDevice(this);
            fizzyo.useRecordedData = false;;  // Change this value to use actual values instead of recorded data
            Services.AddService(typeof(FizzyoDevice), fizzyo);

            breathRecogniser = new BreathRecogniser(maxPressure, maxBreathLength);

            roundTime = GameConstants.RoundTime;
            random    = new Random();

            joyState = new JoystickState();
        }
Пример #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            inputState = new InputState(this);
            Services.AddService(typeof(InputState), inputState);

            fizzyoDevice = new FizzyoDevice(this);
            fizzyoDevice.useRecordedData = true;
            Services.AddService(typeof(FizzyoDevice), fizzyoDevice);

            breathRecogniser = new BreathRecogniser(maxPressure, maxBreathLength);

            LoadfizzyoRecordedData();


            base.Initialize();
        }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        pressures  = new List <float>();
        this.isBad = true;
        FizzyoDevice insatnce = FizzyoDevice.Instance();

        this.gameObject.GetComponent <SpriteRenderer>().enabled = false;

        if (PlayerPrefs.HasKey("Max Fizzyo Pressure"))
        {
            maxFizzyoPressure = PlayerPrefs.GetFloat("Max Fizzyo Pressure");
        }

        breath = new BreathRecogniser(maxFizzyoPressure, 11f);
        breath.ExhalationComplete += ExhalationCompleteHandler;
        //apply default material
        if (lineMaterial == null)
        {
            lineMaterial = new Material(Shader.Find("Sprites/Default"));
        }
        // Store inital position
        respawn = this.transform.position;


        // spawn trajectoryPoints
        if (trajectoryPointPrefab != null)
        {
            for (int i = 0; i < noOfTrajectoryPoints; i++)
            {
                GameObject dot = (GameObject)Instantiate(trajectoryPointPrefab);
                //dot.tag = "trajectoryPoint";
                dot.GetComponent <Renderer>().enabled = false;
                trajectoryPoints.Insert(i, dot);
            }

            for (int i = 0; i < noOfTrajectoryPoints; i++)
            {
                GameObject dot = (GameObject)Instantiate(trajectoryPointPrefab);
                //dot.tag = "trajectoryPoint";
                dot.GetComponent <Renderer>().enabled = false;
                oldTrajectoryPoints.Insert(i, dot);
            }
        }
        else
        {
            Debug.LogWarning("Trajectory prefab is null. Please choose one.");
        }

        // Setup a line renderer
        if (enableSolidLine)
        {
            GameObject m_line_object = new GameObject("line");
            m_line_object.AddComponent <LineRenderer>();
            m_line = m_line_object.GetComponent <LineRenderer>();
            m_line.positionCount     = noOfTrajectoryPoints;
            m_line.colorGradient     = lineColour;
            m_line.numCornerVertices = cornerVerts;
            m_line.numCapVertices    = endVerts;
            m_line.widthCurve        = widthCurve;
            m_line.textureMode       = textureMode;
            m_line.material          = lineMaterial;
            m_line.material.SetFloat("RepeatX", tileAmount);
        }
    }
Пример #4
0
 // Use this for initialization
 void Start()
 {
     breathRecogniser = new BreathRecogniser(maxPressure, maxBreathLength);
     breathRecogniser.ExhalationComplete += BreathAnalyser_ExhalationComplete;
 }