/**
     * @brief Sets the Game Instance Details
     * Assigns gameTitle and difficulty to empty strings. Checks the current game id and assigns the
     * corresponding title to it to the m_gameID value. Gets the current game difficulty int and assigns
     * it a string "easy, medium or hard" (1, 2, 3) through a switch statement. Returns a string containing
     * all details about the game instance.
     *
     * @param
     * @return string
     * @pre
     * @post
     */
    public string gameInstanceDetails()
    {
        string gameTitle  = "";
        string difficulty = "";

        if (GameDataHelper.getCurrentGame().m_gameID == 1)
        {
            gameTitle = "Silhouette Wall";
        }
        else if (GameDataHelper.getCurrentGame().m_gameID == 2)
        {
            gameTitle = "Whack-A-Mole";
        }

        switch (GameDataHelper.getCurrentGame().m_difficulty)
        {
        case 1:
            difficulty = "Easy";
            break;

        case 2:
            difficulty = "Medium";
            break;

        case 3:
            difficulty = "Hard";
            break;
        }



        return("Game: " + gameTitle + "\n" +
               "Difficulty: " + difficulty + "\n" +
               "Duration: " + GameDataHelper.getCurrentGame().m_duration + " seconds");
    }
Example #2
0
    /**
     * @brief Sets the User ID
     * The Login Server stores the userID information in a text file 'currentuser.txt' so the Database Interface
     * reads the text file and stores it in the m_userID then sets the patient to m_userID.
     *
     * @param
     * @return void
     * @pre
     * @post
     */
    private void setUser()
    {
        StreamReader sr = File.OpenText("..\\currentuser.txt");

        m_userID = sr.ReadLine();
        GameDataHelper.setPatient(m_userID);
    }
Example #3
0
    // Use this for initialization
    void Awake()
    {
        game = GameDataHelper.getCurrentGame();
        //GameDataHelper.record();
        switch (game.m_difficulty)
        {
        case 1:
            setEasy();
            break;

        case 2:
            setMedium();
            break;

        case 3:
            setHard();
            break;

        default:
            setHard();
            break;
        }

        gameTime.SetTime(GameDataHelper.getCurrentGame().m_duration);
        //gameTime.SetTime(5.0f);
    }
 /**
  * @brief Checks whether to Enter Game or not
  * If enterGame is true, a game instance is added to the GameDataHelper with the game
  * difficulty and duration. The SceneManager then loads the game scene.
  * @param
  * @return void
  * @pre
  * @post
  */
 private void CheckEnterGameScene()
 {
     if (enterGame)
     {
         GameDataHelper.addGameInstance(1, difficulty, duration);
         SceneManager.LoadScene("Game");
     }
 }
Example #5
0
 private void DataBaseInfoWindow(int windID)
 {
     MapPlacementController.textResourcesPath = GUILayout.TextArea(MapPlacementController.textResourcesPath);
     if (GUILayout.Button("Use Text Data"))
     {
         GameDataHelper.ReloadDataFromFile(MapPlacementController.textResourcesPath, EditionType.ALL, false);
         dataInfoEntered_ = true;
         mrs_             = Global.mapr_mgr.ToArray();
     }
     GUILayout.Space(10);
 }
        public void TestInitialize()
        {
            this.resourceLibrary   = new ResourceLibrary();
            this.controllerManager = new ControllerManager();
            new DependencyContainer()
            .RegisterSingleton <IResourceLibrary>(this.resourceLibrary)
            .RegisterSingleton <IControllerManager>(this.controllerManager);

            this.gameDefinitionId = GameDataHelper.DeepCreateTestGameDefinition(
                this.resourceLibrary, 4, 8, 3, 16, 16);
        }
Example #7
0
 /**
  * @brief Sets Current Game
  * Loops through the program games and checks if the program game has been completed. If true,
  * continues to check the rest of the games in the program games else sets the current game to
  * that of the game that has not been completed and breaks to keep game set at that incomplete
  * game.
  *
  * @param
  * @return void
  * @pre
  * @post
  */
 public void setCurrentGame()
 {
     for (int i = 0; i < m_programGames.Count; i++)
     {
         if (!m_programGames.ElementAt(i).m_completed)
         {
             m_currentGame = m_programGames.ElementAt(i);
             GameDataHelper.setCurrentGame(m_programGames.ElementAt(i));
             break;
         }
     }
 }
Example #8
0
        public void CreateEntity()
        {
            var entityDefinition = this.resources.GetResource <EntityDefinition>(GameDataHelper.DeepCreateTestEntityDefinition(this.resources));
            var entity           = new TestEntity(
                entityDefinition,
                this.resources,
                this.avatarFactory,
                new[] { this.entityControllerFactory },
                new ControllerConfig[0],
                Vector3D.Zero,
                Vector3D.Zero,
                Vector3D.Zero);

            Assert.IsNotNull(entity);
        }
    /**
     * @brief Overloaded Start Function
     * Initialises the Game Management class. Sets the selectedArcade to null, enterGame to false,
     * isOpenMenu to false. If the current program is complete, will set the current game from the game
     * list.
     *
     * @param
     * @return void
     * @pre
     * @post
     */
    void Start()
    {
        selectedArcade = "";
        enterGame      = false;
        isOpenMenu     = false;


        m_progComplete = m_dbInterface.programComplete();

        if (!m_progComplete)
        {
            GameDataHelper.setCurrentGame(m_dbInterface.getCurrentGame());
        }

        m_gameList = m_dbInterface.getGameList();
    }
Example #10
0
        public void CreateEntityWithControllers()
        {
            var entityDefinition = this.resources.GetResource <EntityDefinition>(GameDataHelper.DeepCreateTestEntityDefinition(this.resources));

            entityDefinition.Controllers = new[]
            {
                new ControllerConfig
                {
                    ControllerId = "controller.testA",
                    Settings     = { { "Foo", "512" }, { "Bar", "Hello World." } }
                },
                new ControllerConfig
                {
                    ControllerId = "controller.testB",
                    Settings     = { { "Foo", "42" }, { "Bar", "Don't Panic" } }
                },
            };
            var controllers = new[]
            {
                new ControllerConfig
                {
                    ControllerId = "controller.testB",
                    Settings     = { { "Bar", "Keep Calm" } }
                },
                new ControllerConfig
                {
                    ControllerId = "controller.testC",
                    Settings     = { { "Foo", "159" }, { "Bar", "Carry On" } }
                },
            };
            var entity = new TestEntity(
                entityDefinition,
                this.resources,
                this.avatarFactory,
                this.controllerFactories,
                controllers,
                Vector3D.Zero,
                Vector3D.Zero,
                Vector3D.Zero);

            Assert.IsTrue(entity.Controllers.All(c => c.Target == entity));
            Assert.IsFalse(entity.Controllers.Any(c => c.Id.ResourceId.StartsWith("controller.testB") && c.Config.GetValue("Bar") == "Don't Panic"));
            Assert.IsTrue(entity.Controllers.Any(c => c.Id.ResourceId.StartsWith("controller.testB") && c.Config.GetValue("Foo") == "42"));
            Assert.IsTrue(entity.Controllers.Any(c => c.Id.ResourceId.StartsWith("controller.testB") && c.Config.GetValue("Bar") == "Keep Calm"));
        }
Example #11
0
    AudioSource audioSource;          // Audio Source object

    /**
     * @brief Overloaded Start Function
     * Initialises the Game Logic class. Sets the game instance, begins the Kinect recording,
     * sets the game difficulty and initialises audio features.
     *
     * @param
     * @return void
     * @pre
     * @post
     */
    void Start()
    {
        game = GameDataHelper.getCurrentGame();
        GameDataHelper.record();
        switch (game.m_difficulty)
        {
        case 1:
            setEasy();
            break;

        case 2:
            setMedium();
            break;

        case 3:
            setHard();
            break;
        }
        audioSource = GetComponent <AudioSource>();
    }
Example #12
0
    /**
     * @brief Sets Current Game Instance
     *
     * @param int gid
     * @param int difficulty
     * @param int time
     * @return GameDataHelper.GameInstance gi
     * @pre
     * @post
     */
    public GameDataHelper.GameInstance addGameInstance(int gid, int difficulty, int time)
    {
        int         ginstid;
        int         count = 0;
        OdbcCommand cmd   = new OdbcCommand();

        cmd.Connection  = con;
        cmd.CommandText = "INSERT INTO GAMEINSTANCE(GameID, Difficulty, Duration) VALUES(" + gid + ", '" + difficulty + "', " + time + ")";
        cmd.ExecuteNonQuery();

        cmd.CommandText = "SELECT COUNT(*) FROM GAMEINSTANCE";
        OdbcDataReader read = cmd.ExecuteReader();

        read.Read();
        int total = read.GetInt32(0);

        read.Close();

        cmd.CommandText = "SELECT GameInstanceID FROM GAMEINSTANCE";
        read            = cmd.ExecuteReader();

        while (count < total - 1)
        {
            read.Read();
            count++;
        }

        read.Read();
        ginstid = read.GetInt32(0);

        GameDataHelper.GameInstance gi = new GameDataHelper.GameInstance();
        gi.m_gameInstanceID = ginstid;
        gi.m_gameID         = gid;
        gi.m_difficulty     = difficulty;
        gi.m_duration       = time;

        GameDataHelper.setCurrentGame(gi);

        return(gi);
    }
Example #13
0
 /**
  * @brief Overloaded OnDelete Function
  * Adds the metrics of the game to database that is playerScore and time.
  *
  * @param
  * @return void
  * @pre
  * @post
  */
 void OnDelete()
 {
     GameDataHelper.AddMetricsToDatabase(playerScore, time);
 }
Example #14
0
 public void Start()
 {
     GameDataHelper.ReloadDataFromFile(MapPlacementController.textResourcesPath, EditionType.ALL, false);
     mrs_ = LoadMapInfoFromTxt().ToArray();
     mrs_ = Global.mapr_mgr.ToArray();
 }
 public void OnDestroy()
 {
     dataHelper = null;
 }
 public void Start()
 {
     StartCoroutine(FadeInQuestionnaire());
     dataHelper = GameDataHelper.Instance;
 }
Example #17
0
 public void RestartInstance()
 {
     instance = new GameDataHelper();
 }