Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        theButton = this.GetComponentInParent <Button>();
        Button btn = theButton.GetComponent <Button>();

        btn.onClick.AddListener(TaskOnClick);

        managerObject = GameObject.Find("ChrCreationManager");
        manager       = managerObject.GetComponent <ChrCreationManager>();
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void TaskOnClick()
    {
        GameObject         manager       = GameObject.Find("ChrCreationManager");
        ChrCreationManager managerScript = manager.GetComponent <ChrCreationManager>();

        GameObject nameTipText = GameObject.Find("NameTipText");
        GameObject attTipText  = GameObject.Find("AttTipText");

        string tip = "";

        if (nameCondition)
        {
            if (managerScript.tempCharacter.characterName == "nullName")
            {
                tip = "Please enter a valid name!";
                nameTipText.GetComponent <Text>().text = tip;

                return;
            }
        }
        if (attCondition)
        {
            if (managerScript.SkillPoints != 0)
            {
                tip = "Please spend all attribute points!";
                attTipText.GetComponent <Text>().text = tip;

                return;
            }
        }

        Vector3 newFinal;

        if (target != null)
        {
            float tempX, tempY;
            tempX = finalPos.x;
            tempY = finalPos.y;

            newFinal    = target.transform.position;
            newFinal.x += tempX;
            newFinal.y += tempY;
            newFinal.z  = mainCamera.transform.position.z;
        }
        else
        {
            newFinal = finalPos;
        }
        SmoothMoveToPoint cameraMove = mainCamera.GetComponent <SmoothMoveToPoint>();

        cameraMove.MoveToPoint(newFinal);

        if (nameCondition)
        {
            tip = "";
            nameTipText.GetComponent <Text>().text = tip;
        }
        if (attCondition)
        {
            tip = "";
            attTipText.GetComponent <Text>().text = tip;
        }
    }