コード例 #1
0
    void Restart()
    {
        int level = PlayerAdaptiveInfo.getCurrLevel();

        //SceneManager.LoadScene (SceneManager.GetActiveScene().name);
        SceneManager.LoadScene(level);
    }
コード例 #2
0
 public void EndGame(string reason)
 {
     if (!isGameEnded)
     {
         Debug.Log("End reason : " + reason);
         PlayerAdaptiveInfo.IncreaseRestartCount();
         Attempts attempt = new Attempts();
         attempt.Completed   = false;
         attempt.FailureType = reason;
         attempt.Level       = PlayerAdaptiveInfo.getCurrLevel();
         attempt.SessionId   = PlayerStats.SessionDetails.SessionId;
         attempt.SideForce   = PlayerAdaptiveInfo.adaptiveInfo.sideForce;
         attempt.Speed       = PlayerAdaptiveInfo.adaptiveInfo.currSpeed;
         PlayerStats.AddAttemptData(attempt);
         if (reason.Equals(COLLISION))
         {
             PlayerAdaptiveInfo.IncreaseCollisionCount();
         }
         PlayerAdaptiveInfo.adjustSpeedOrLevel();
         Debug.Log("Game Over");
         isGameEnded = true;
         Invoke("Restart", restartDelay);
         //Restart ();
     }
 }
コード例 #3
0
    void spawnBlocks()
    {
        int           level         = SceneManager.GetActiveScene().buildIndex;
        HashSet <int> randomIndices = new HashSet <int>();

        if (PlayerAdaptiveInfo.isStrictModeOn())
        {
            while (randomIndices.Count < blocks[level])
            {
                int randomIndex = Random.Range(0, spawnPoints.Length);
                randomIndices.Add(randomIndex);
            }
        }
        else
        {
            for (int i = 0; i < blocks [level]; i++)
            {
                int randomIndex = Random.Range(0, spawnPoints.Length);
                randomIndices.Add(randomIndex);
            }
        }

        Debug.Log("at indices " + randomIndices.Count + " level : " + level);


        for (int i = 0; i < spawnPoints.Length; i++)
        {
            if (randomIndices.Contains(i))
            {
                Instantiate(blockPreFab, spawnPoints[i].position, Quaternion.identity);
            }
        }
        randomIndices.Clear();
    }
コード例 #4
0
 public void LoadNextLevel()
 {
     Debug.Log("loading Next level");
     PlayerAdaptiveInfo.IncreaseSpeed();
     PlayerAdaptiveInfo.resetRestarts();
     PlayerAdaptiveInfo.setCurrLevel(SceneManager.GetActiveScene().buildIndex + 1);
     SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
 }
コード例 #5
0
 // Use this for initialization
 void Awake()
 {
     if (adaptiveInfo == null)
     {
         adaptiveInfo = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (adaptiveInfo != this)
     {
         Destroy(gameObject);
     }
 }
コード例 #6
0
    //public GameManager gameManager;

    public void StartGame()
    {
        Debug.Log("Name: " + username.text + "Age: " + Age.text);


        var p = new User {
            Name    = username.text,
            Surname = "NA",
            Age     = int.Parse(Age.text)
        };
        var  ds  = new DataService("tempDatabase.db");
        User tmp = ds.CreateGivenUser(p);

        PlayerStats.UserDetails = tmp;
        PlayerStats.CreateSession();

        PlayerAdaptiveInfo.adaptiveInfo.userName = username.text;
        PlayerAdaptiveInfo.setCurrLevel(SceneManager.GetActiveScene().buildIndex + 1);
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
    }