Exemple #1
0
    /// <summary>
    /// Adds the user to the gamescene and this handlers list.
    /// Adjusts the PressurePlates according to number of players in session.
    /// </summary>
    /// <param name="user_ref">User reference in session (a, b, c or d).</param>
    /// <param name="user_id">User identifier in database.</param>
    /// <param name="user_name">User name.</param>
    public void AddUser(string user_ref, int user_id, string user_name)
    {
        if (users.Count < 4)
        {
            GameObject usr = GameObject.Instantiate(
                userPrefab,
                new Vector3(0, 0, 0),
                Quaternion.Euler(0, 0, 0),
                gameObject.transform);

            usr.GetComponent <Rigidbody>().MovePosition(SoftwareModel.GetComponent <LevelBehaviour> ().GetStartPosition(users.Count));
            usr.transform.localRotation = Quaternion.Euler(SoftwareModel.GetComponent <LevelBehaviour> ().GetStartRotation(users.Count));
            // Alter name of GameObject for clarification between GameObjects.
            usr.name = "USER: "******" : " + user_name;
            pauseMenuController.GetComponent <PauseMenu> ().AddAnimator(usr.GetComponent <Animator> ());
        }
        // Set the timeOut of PressurePlate according to number of players in game.
        PressurePlate.TimeOut = SoftwareModel.GetComponent <LevelBehaviour> ().GetPlateTimeOut(users.Count);
    }
Exemple #2
0
    /*/// <summary>
     * /// Gets the identifier of the user in database.
     * /// </summary>
     * /// <returns>The identifier.</returns>
     * /// <param name="usr">Usr.</param>
     * public int GetIndex(User usr) {
     *
     *      return users.IndexOf (usr);
     * }*/

    /// <summary>
    /// Adds the user to the gamescene and this handlers list.
    /// </summary>
    /// <param name="user_ref">User reference in session (a, b, c or d).</param>
    /// <param name="user_id">User identifier in database.</param>
    /// <param name="user_name">User name.</param>
    public void AddUser(string user_ref, int user_id, string user_name)
    {
        if (users.Count < 4)
        {
            GameObject usr = GameObject.Instantiate(
                userPrefab,
                StartLevel_1.GetStartPosition(users.Count),
                Quaternion.Euler(0, 0, 0),
                gameObject.transform);
            users.Add(usr.GetComponent <User> ());
            UserStatics.SetUserInfo(users.IndexOf(usr.GetComponent <User> ()), user_id, user_name, user_ref);
            if (UserStatics.IsMySelf(users.IndexOf(usr.GetComponent <User> ())))
            {
                usr.GetComponent <User> ().IsPlayed = true;
            }
            usr.GetComponent <User>().userInfo.GetComponent <TextMesh>().text = user_ref + " : " + user_name;
        }
    }