예제 #1
0
    public void CustomizeAccepted()
    {
                #if UNITY_EDITOR
        //animUtils = GetComponent<AnimationCreaterUtils>();
        //animUtils.CreateSprite("back/back_place","back2_both_quiver","sprite/items/back/male/quiver");
                #endif
        PlayerController.playerExists = true;
        UIManager.UIexist             = true;

        DontDestroyOnLoad(playerObject);
        DontDestroyOnLoad(uiObject);

        thePlayer.activeScene = mainGameScen;

        menuScript.isGameRun = true;
        //var clone = FindObjectOfType<CameraControler>();
        //clone.GetComponent<Camera>().orthographicSize = 5.0f;
        //clone.offset = new Vector2(0,0);
        theCamera = FindObjectOfType <CameraControler>();
        theCamera.GetComponent <Camera>().orthographicSize = 5.0f;
        theCamera.offset = new Vector2(0, 0);

        //thePlayer.joyAction.gameObject.SetActive(true);
        thePlayer.joyAttack.gameObject.SetActive(true);
        thePlayer.joySpell.gameObject.SetActive(true);
        hpSlider.gameObject.SetActive(true);

        theLoadingScript.loading.SetActive(true);
        StartCoroutine(theLoadingScript.LoadLevelWithBar(mainGameScen));
        //SceneManager.LoadScene(mainGameScen);
    }
예제 #2
0
/*    void OnGUI() {
 *
 *                      GUI.DrawTexture(colorPanelRect, colorPicker);
 *                      if (GUI.RepeatButton(colorPanelRect, ""))
 *                      {
 *                              Vector2 pickpos  = Event.current.mousePosition;
 *                              float aaa  = pickpos.x - colorPanelRect.x;
 *
 *                              float bbb  =  pickpos.y - colorPanelRect.y;
 *
 *                              int aaa2  = (int)(aaa * (colorPicker.width / (colorPanelRect.width + 0.0f)));
 *
 *                              int bbb2  =  (int)((colorPanelRect.height - bbb) * (colorPicker.height / (colorPanelRect.height + 0.0f)));
 *
 *                              col  = colorPicker.GetPixel(aaa2, bbb2);
 *
 *                              switch (colorChoiceEnum){
 *
 *                                      case enumColorChoice.RACE:
 *                                              body.color = col;
 *                                      break;
 *
 *                                      case enumColorChoice.HAIR:
 *                                              hair.color = col;
 *                                      break;
 *
 *                                      case enumColorChoice.EARS:
 *                                              ears.color = col;
 *                                      break;
 *
 *                                      case enumColorChoice.EYES:
 *                                              eyes.color = col;
 *                                      break;
 *
 *                                      case enumColorChoice.NOSE:
 *                                              nose.color = col;
 *                                      break;
 *
 *                                      case enumColorChoice.FACIAL:
 *                                              facial.color = col;
 *                                      break;
 *                              }
 *                              //Debug.Log(aaa2 + "||||||" + bbb2);
 *
 *                      }
 *
 *
 *      }*/
    // Use this for initialization
    void Start()
    {
        theCamera = FindObjectOfType <CameraControler>();
        theCamera.GetComponent <Camera>().orthographicSize = 2.0f;
        theCamera.offset = new Vector2(0.77f, -0.33f);

        ///size image, button, cricleColor etc
        colorPickerWheel.GetComponent <ColorWheelControl>().PickColor(Color.white);
        float widthImage        = Screen.width / 2.1f;
        float heightImage       = Screen.height;
        float circelWidth       = widthImage / 2.3f;
        float buttonWidth       = widthImage / 3;
        float buttonHeight      = heightImage / 9;
        float sliderWidth       = widthImage * 0.7f;
        float sliderHeight      = heightImage / 9;
        float sliderSpaceWidth  = widthImage * 0.4f;
        float sliderSpaceHieght = heightImage / 9 / 2.4f;
        float textWidth         = widthImage / 4;

        OptionSliderImage.GetComponent <RectTransform>().sizeDelta = new Vector2(widthImage, heightImage);

        colorPickerWheel.GetComponent <RectTransform>().sizeDelta        = new Vector2(circelWidth, circelWidth);
        colorPickerWheel.GetComponent <RectTransform>().anchoredPosition = new Vector3(-circelWidth, circelWidth / 1.8f, 0);
        colorPickerWheel.GetComponent <ColorWheelControl>().refreshSize();

        AcceptedButton.GetComponent <RectTransform>().sizeDelta        = new Vector2(buttonWidth, buttonWidth);
        AcceptedButton.GetComponent <RectTransform>().anchoredPosition = new Vector3(-widthImage - buttonWidth * 0.8f, buttonHeight + buttonHeight / 4, 0);
        GenderButton.GetComponent <RectTransform>().sizeDelta          = new Vector2(buttonWidth, buttonWidth);
        GenderButton.GetComponent <RectTransform>().anchoredPosition   = new Vector3(-widthImage - buttonWidth * 0.8f, -buttonHeight - buttonHeight / 4, 0);

        raceSlider.GetComponent <RectTransform>().sizeDelta              = new Vector2(sliderWidth, sliderHeight);
        raceSlider.GetComponent <RectTransform>().anchoredPosition       = new Vector3(-sliderSpaceWidth, -sliderSpaceHieght, 0);
        hairSlider.GetComponent <RectTransform>().sizeDelta              = new Vector2(sliderWidth, sliderHeight);
        hairSlider.GetComponent <RectTransform>().anchoredPosition       = new Vector3(-sliderSpaceWidth, -sliderSpaceHieght - sliderHeight, 0);
        earsSlider.GetComponent <RectTransform>().sizeDelta              = new Vector2(sliderWidth, sliderHeight);
        earsSlider.GetComponent <RectTransform>().anchoredPosition       = new Vector3(-sliderSpaceWidth, -sliderSpaceHieght - (2 * sliderHeight), 0);
        eyesSlider.GetComponent <RectTransform>().sizeDelta              = new Vector2(sliderWidth, sliderHeight);
        eyesSlider.GetComponent <RectTransform>().anchoredPosition       = new Vector3(-sliderSpaceWidth, -sliderSpaceHieght - (3 * sliderHeight), 0);
        noseSlider.GetComponent <RectTransform>().sizeDelta              = new Vector2(sliderWidth, sliderHeight);
        noseSlider.GetComponent <RectTransform>().anchoredPosition       = new Vector3(-sliderSpaceWidth, -sliderSpaceHieght - (4 * sliderHeight), 0);
        facialHairSlider.GetComponent <RectTransform>().sizeDelta        = new Vector2(sliderWidth, sliderHeight);
        facialHairSlider.GetComponent <RectTransform>().anchoredPosition = new Vector3(-sliderSpaceWidth, -sliderSpaceHieght - (5 * sliderHeight), 0);

        raceText.GetComponent <RectTransform>().sizeDelta          = new Vector2(textWidth, sliderHeight);
        raceText.GetComponent <RectTransform>().anchoredPosition   = new Vector3(-sliderWidth - textWidth / 2, 0, 0);
        hairText.GetComponent <RectTransform>().sizeDelta          = new Vector2(textWidth, sliderHeight);
        hairText.GetComponent <RectTransform>().anchoredPosition   = new Vector3(-sliderWidth - textWidth / 2, 0, 0);
        earsText.GetComponent <RectTransform>().sizeDelta          = new Vector2(textWidth, sliderHeight);
        earsText.GetComponent <RectTransform>().anchoredPosition   = new Vector3(-sliderWidth - textWidth / 2, 0, 0);
        eyesText.GetComponent <RectTransform>().sizeDelta          = new Vector2(textWidth, sliderHeight);
        eyesText.GetComponent <RectTransform>().anchoredPosition   = new Vector3(-sliderWidth - textWidth / 2, 0, 0);
        noseText.GetComponent <RectTransform>().sizeDelta          = new Vector2(textWidth, sliderHeight);
        noseText.GetComponent <RectTransform>().anchoredPosition   = new Vector3(-sliderWidth - textWidth / 2, 0, 0);
        facialText.GetComponent <RectTransform>().sizeDelta        = new Vector2(textWidth, sliderHeight);
        facialText.GetComponent <RectTransform>().anchoredPosition = new Vector3(-sliderWidth - textWidth / 2, 0, 0);

        //size descripton image
        DescriptionImage.GetComponent <RectTransform>().sizeDelta = new Vector2(widthImage / 1.8f, heightImage / 1.8f);

        LoadingImage.GetComponent <RectTransform>().sizeDelta        = new Vector2(Screen.width + 100, Screen.height + 100);
        LoadingImage.GetComponent <RectTransform>().anchoredPosition = new Vector3(0, 0, 10);



        dManager          = playerObject.GetComponent <DialogueManager>();
        animUtils         = playerObject.GetComponent <AnimationCreaterUtils>();
        thePlayerAnimator = playerObject.GetComponent <Animator>();
        menuScript        = GetComponent <menuScript>();
        theLoadingScript  = GetComponent <loadingScript>();


        thePlayer.joyAction.gameObject.SetActive(false);
        thePlayer.joyAttack.gameObject.SetActive(false);
        thePlayer.joySpell.gameObject.SetActive(false);

        hpSlider = uiObject.GetComponentInChildren <Slider>();
        hpSlider.gameObject.SetActive(false);

        thePlayer.isMan = true;
        GenderButton.GetComponentInChildren <Text>().GetComponent <Text>().text = "MAN";

        raceSlider.maxValue       = (int)AnimationCreaterUtils.enumRace.NONE - 1;
        raceSlider.value          = (int)AnimationCreaterUtils.enumRace.BLACK;
        hairSlider.maxValue       = (int)AnimationCreaterUtils.enumHair.NONE;
        hairSlider.value          = (int)AnimationCreaterUtils.enumHair.NONE;
        earsSlider.maxValue       = (int)AnimationCreaterUtils.enumEars.NONE;
        earsSlider.value          = (int)AnimationCreaterUtils.enumEars.NONE;
        eyesSlider.maxValue       = (int)AnimationCreaterUtils.enumEyes.NONE;
        eyesSlider.value          = (int)AnimationCreaterUtils.enumEyes.NONE;
        noseSlider.maxValue       = (int)AnimationCreaterUtils.enumNose.NONE;
        noseSlider.value          = (int)AnimationCreaterUtils.enumNose.NONE;
        facialHairSlider.maxValue = (int)AnimationCreaterUtils.enumFacial.NONE;
        facialHairSlider.value    = (int)AnimationCreaterUtils.enumFacial.NONE;

        //get actual texture to new gender from slider
        ChoiceRace();
        ChoiceHair();
        ChoiceEras();
        ChoiceEyes();
        ChoiceNose();
        ChoiceFacialHair();


        //var clone1 = FindObjectOfType<CameraControler>();
        //clone1.GetComponent<Camera>().orthographicSize = 2.0f;
        //clone1.offset = new Vector2(0.77f,-0.33f);
    }