예제 #1
0
    public void CreateLumberjack()
    {
        if (lumberjackSelector.findLumberjack(username.text))
        {
            error.text = "Name is already taken";
            return;
        }

        if (password.text != passwordRepeat.text)
        {
            error.text = "Passwords don't match";
            return;
        }

        Character lumberjackCharacter = lumberjackDummy.GetComponent <Character>();

        lumberjackCharacter.loadCharacter(username.text, password.text, walkSpeed, axeSpeed, axePower, backpackSize, money, lumberCount);
        lumberjackDummy.transform.position = spawnPoint;

        clearFields();
        lumberUI.displayPlay();
        lumberjackSelector.cameraObject.GetComponent <CameraController>().controlEnabled = true;

        spawnOnClick = true;
    }
예제 #2
0
    public void Login()
    {
        GameObject lumberjack = lumberjackSelector.findLumberjack(username.text);

        if (lumberjack == null)
        {
            Debug.Log("WrongUsername");
            error.text = wrongUsername;
            return;
        }
        Character lumberjackCharacter = lumberjack.GetComponent <Character> ();

        if (lumberjackCharacter.password != password.text)
        {
            error.text = wrongPassword;
            return;
        }

        lumberjackSelector.makeActiveLumberjack(lumberjack);
        lumberjackSelector.zoomToActiveLumberjack();
        clearFields();
        lumberUI.displayPlay();
    }