示例#1
0
    void Start()
    {
        CortexFacade.SetUpConfiguration();
        CortexFacade.InitializeTrainer();

        CortexFacade.Authorize();
    }
示例#2
0
    /// <summary>
    /// Update is called once per frame
    /// Calls the GameOver method if the game is over
    /// </summary
    void Update()
    {
        if (IsGameOver())
        {
            GameOver();
        }

        else
        {
            frames += 1;
            string action = CortexFacade.GetAction();
            if (action != "neutral")
            {
                attentionFrames += 1;
                IncreaseHealth(0.1f);
                attentionButton.GetComponent <Image>().color = new Color(0f, 200f / 255f, 0f, 175 / 255f);
                neutralButton.GetComponent <Image>().color   = new Color(106f / 255f, 106f / 255f, 106f / 255f, 175 / 255f);
                // Update button color
            }

            else
            {
                attentionButton.GetComponent <Image>().color = new Color(106f / 255f, 106f / 255f, 106f / 255f, 175 / 255f);
                neutralButton.GetComponent <Image>().color   = new Color(200f / 255f, 0f, 0f, 175 / 255f);
                // Update button color
            }
        }
    }
示例#3
0
    /// <summary>
    /// Controls the shooting mechanism of the game using Raycasts
    /// </summary>
    void Shoot()
    {
        RaycastHit hit;

        if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit))
        {
            Target target = hit.transform.GetComponent <Target>();
            if (target != null)
            {
                string Action = CortexFacade.GetAction();

                float damage = baseDamage;

                if (Action != "neutral")
                {
                    damage *= 5.0f;
                }

                target.TakeDamage(damage);
            }

            GameObject tempFlash;
            GameObject impactEffect;
            tempFlash    = Instantiate(muzzleFlash, barrelLocation.position, barrelLocation.rotation);
            impactEffect = Instantiate(impactFlash, hit.point, Quaternion.LookRotation(hit.normal));
            audioData    = GetComponent <AudioSource>();
            if (audioData != null)
            {
                audioData.Play(0);
            }
            Destroy(tempFlash, 2);
            Destroy(impactEffect, 2);
        }
    }
示例#4
0
    // Update is called once per frame
    void Update()
    {
        string Action = CortexFacade.GetAction();

        if (Action != "neutral")
        {
            float x = box.transform.position.x + 0.01f;
            float y = 0;
            float z = 0;
            box.transform.position = new Vector3(x, y, z);
        }
    }
示例#5
0
 /// <summary>
 /// Invokes LoadMenu in 5 seconds
 /// </summary>
 public void GameOver()
 {
     if (!locker)
     {
         string url        = "http://localhost:8000/players";
         Player player     = new Player(CortexFacade.User, score, (attentionFrames / frames) * 100);
         string playerJSON = player.Stringify();
         StartCoroutine(ServerController.Post(url, playerJSON,
                                              result => {
             Debug.Log(result);
         }));
         CortexFacade.Stop();
         scoreText.text = "Final Score: " + score.ToString();
         Invoke("LoadMenu", 5);
         locker = true;
     }
 }
示例#6
0
    public void Submit()
    {
        string profileName = profileField.text;
        string headsetID   = headsetField.text;

        Debug.Log(profileName);
        Debug.Log(headsetID);

        // Check if Headset Exists

        bool profileExists = CortexFacade.FindProfile(profileName);

        if (!profileExists)
        {
            Debug.Log("Profile doesn't exist");
            return;
        }

        bool headsetExist = CortexFacade.FindHeadset(headsetID);

        if (!headsetExist)
        {
            Debug.Log("Headset doesn't exist");
            return;
        }



        Debug.Log(profileExists);
        Debug.Log(headsetExist);

        if (headsetExist && profileExists)
        {
            CortexFacade.Device = headsetID;
            CortexFacade.User   = profileName;

            CortexFacade.LoadProfile(profileName);
            SceneManager.LoadScene("MainMenu");
        }
    }
示例#7
0
 public void QueryHeadset()
 {
     CortexFacade.QueryHeadset();
 }
示例#8
0
 public void QueryProfile()
 {
     CortexFacade.QueryProfile();
 }