Exemple #1
0
    void OnTriggerEnter2D(Collider2D player)
    {
        //DATA COLLECTION CODE-------------------------------------------------------------------------------------------------------------------------------------
        gameData.ActivateSwitchTime(currentScene.name + " BottomSwitch pressed by " + player.name, timerController.GetTime());
        gameData.GameInteraction(currentScene.name + " Player " + player.name + " stepped ON the BOTTOM switch " + DateTime.Now.ToString("h:mm:ss tt") + ", ", timerController.GetTime());
        //DATA COLLECTION CODE-------------------------------------------------------------------------------------------------------------------------------------
        if (!colliders.Contains(player))
        {
            colliders.Add(player);
        }

        if (colliders.Count > 1 && !isDestroyed)
        {
            isDestroyed = true;
            //make doors open

            GameObject[] bottomDoor = GameObject.FindGameObjectsWithTag("Door Bottom");
            Destroy(bottomDoor[0]);
            Destroy(bottomDoor[1]);
            //DATA COLLECTION CODE-------------------------------------------------------------------------------------------------------------------------------------
            gameData.DoorOpen(currentScene.name + " BottomDoor open", timerController.GetTime());
            gameData.GameInteraction(currentScene.name + " BOTTOM door open: both top players stepped on the bottom switch " + DateTime.Now.ToString("h:mm:ss tt") + ", ", timerController.GetTime());
            //DATA COLLECTION CODE-------------------------------------------------------------------------------------------------------------------------------------
        }
    }
Exemple #2
0
 void OnTriggerEnter2D(Collider2D player)
 {
     if (PhotonNetwork.IsConnected && gameData != null)
     {
         //DATA COLLECTION CODE-------------------------------------------------------------------------------------------------------------------------------------
         gameData.ActivateSwitchTime(currentScene.name + " FinalSwitch pressed by " + player.name, timerController.GetTime());
         gameData.GameInteraction(currentScene.name + " Player " + player.name + " stepped ON the FINAL switch at time " + DateTime.Now.ToString("h:mm:ss tt") + ", ", timerController.GetTime());
         //DATA COLLECTION CODE-------------------------------------------------------------------------------------------------------------------------------------
     }
     if (!playersOnFinalSwitch.Contains(player.name))
     {
         playersOnFinalSwitch.Add(player.name);
     }
     // changes based on what level we're currently on
     // will need to add more as more levels are added
     if (playersOnFinalSwitch.Count == 4)
     {
         // if(!testing) {
         if (PhotonNetwork.IsConnected && gameData != null)
         {
             //DATA COLLECTION CODE-------------------------------------------------------------------------------------------------------------------------------------
             gameData.FinishLevelTime(currentScene.name + " FinalSwitch pressed by " + player.name, timerController.GetTime());
             gameData.GameInteraction(currentScene.name + " Player " + player.name + " stepped ON the FINAL switch " + DateTime.Now.ToString("h:mm:ss tt") + ", ", timerController.GetTime());
             //DATA COLLECTION CODE-------------------------------------------------------------------------------------------------------------------------------------
         }
         // you want to change the index based on how you build the game and which scenes you have in which order
         if (currentScene.name == "TutorialLevel")  //go to level 2
         {
             UpdateLevel(3);
         }
         else if (currentScene.name == "Level2")     // go to level 3
         {
             UpdateLevel(4);
         }
         else if (currentScene.name == "Level3")     // go to level 4
         {
             UpdateLevel(5);
         }
         else if (currentScene.name == "Level4")     // end scene
         {
             UpdateLevel(6);
         }
         else
         {
             Debug.LogError("Level is possibly wrong, possibly error in incrementing or decrementing the infoOjbect level attribute.");
         }
     }
 }