/* 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); }
// Use this for initialization void Start() { animUtils = GetComponent <AnimationCreaterUtils>(); theNPCAnimator = GetComponent <Animator>(); string enumHand = ""; //load body animation bodySprite.color = bodyColor; if (isMale) { enumOverrideRace = (AnimationCreaterUtils.enumRace)System.Enum.Parse(typeof(AnimationCreaterUtils.enumRace), enumOverrideRaceMale.ToString()); } else { enumOverrideRace = (AnimationCreaterUtils.enumRace)System.Enum.Parse(typeof(AnimationCreaterUtils.enumRace), enumOverrideRaceFemale.ToString()); } path = animUtils.backBodyName((int)enumOverrideRace); animUtils.loadAnimationClip(path, isMale, "body", "Animation/Character/"); animUtils.customizeAnimationSet(animUtils.arrayOneObjectAnimationHandler, (int)enumOverrideRace, "body", theNPCAnimator); //load hair animation hairSprite.color = hairColor; path = animUtils.backHairName((int)enumOverrideHair); animUtils.loadAnimationClip(path, isMale, "hair", "Animation/Character/"); animUtils.customizeAnimationSet(animUtils.arrayOneObjectAnimationHandler, (int)enumOverrideHair, "hair", theNPCAnimator); //load ears animation earsSprite.color = earsColor; path = animUtils.backEarsName((int)enumOverrideEars); animUtils.loadAnimationClip(path, isMale, "ears", "Animation/Character/"); animUtils.customizeAnimationSet(animUtils.arrayOneObjectAnimationHandler, (int)enumOverrideEars, "ears", theNPCAnimator); //load eyes animation eyesSprite.color = eyesColor; path = animUtils.backEyesName((int)enumOverrideEyes); animUtils.loadAnimationClip(path, isMale, "eyes", "Animation/Character/"); animUtils.customizeAnimationSet(animUtils.arrayOneObjectAnimationHandler, (int)enumOverrideEyes, "eyes", theNPCAnimator); //load nose animation noseSprite.color = noseColor; path = animUtils.backNoseName((int)enumOverrideNose); animUtils.loadAnimationClip(path, isMale, "nose", "Animation/Character/"); animUtils.customizeAnimationSet(animUtils.arrayOneObjectAnimationHandler, (int)enumOverrideNose, "nose", theNPCAnimator); //load facialhair aniamtion facialSprite.color = facialColor; path = animUtils.backFacialName((int)enumOverrideFacial); animUtils.loadAnimationClip(path, isMale, "facial", "Animation/Character/"); animUtils.customizeAnimationSet(animUtils.arrayOneObjectAnimationHandler, (int)enumOverrideFacial, "facial", theNPCAnimator); /////////////////////////////////////items///////////////////////////// //load arms aniamtion if (isMale) { enumOverrideArms = (AnimationCreaterUtils.enumArms)System.Enum.Parse(typeof(AnimationCreaterUtils.enumArms), enumOverrideArmsMale.ToString()); } else { enumOverrideArms = (AnimationCreaterUtils.enumArms)System.Enum.Parse(typeof(AnimationCreaterUtils.enumArms), enumOverrideArmsFemale.ToString()); } armsSprite.color = armsColor; path = animUtils.backArmsName((int)enumOverrideArms); animUtils.loadAnimationClip(path, isMale, "arms", "Animation/items/"); animUtils.customizeAnimationSet(animUtils.arrayOneObjectAnimationHandler, (int)enumOverrideArms, "arms", theNPCAnimator); //load back aniamtion if (isMale) { enumOverrideBack = (AnimationCreaterUtils.enumBack)System.Enum.Parse(typeof(AnimationCreaterUtils.enumBack), enumOverrideBackMale.ToString()); } else { enumOverrideBack = (AnimationCreaterUtils.enumBack)System.Enum.Parse(typeof(AnimationCreaterUtils.enumBack), enumOverrideBackFemale.ToString()); } backSprite.color = backColor; path = animUtils.backBackName((int)enumOverrideBack); animUtils.loadAnimationClip(path, isMale, "back", "Animation/items/"); animUtils.customizeAnimationSet(animUtils.arrayOneObjectAnimationHandler, (int)enumOverrideBack, "back", theNPCAnimator); //load Chest aniamtion if (isMale) { enumOverrideChest = (AnimationCreaterUtils.enumChest)System.Enum.Parse(typeof(AnimationCreaterUtils.enumChest), enumOverrideChestMale.ToString()); } else { enumOverrideChest = (AnimationCreaterUtils.enumChest)System.Enum.Parse(typeof(AnimationCreaterUtils.enumChest), enumOverrideChestFemale.ToString()); } chestSprite.color = chestColor; path = animUtils.backChestName((int)enumOverrideChest); animUtils.loadAnimationClip(path, isMale, "chest", "Animation/items/"); animUtils.customizeAnimationSet(animUtils.arrayOneObjectAnimationHandler, (int)enumOverrideChest, "chest", theNPCAnimator); //load Feet aniamtion if (isMale) { enumOverrideFeet = (AnimationCreaterUtils.enumFeet)System.Enum.Parse(typeof(AnimationCreaterUtils.enumFeet), enumOverrideFeetMale.ToString()); } else { enumOverrideFeet = (AnimationCreaterUtils.enumFeet)System.Enum.Parse(typeof(AnimationCreaterUtils.enumFeet), enumOverrideFeetFemale.ToString()); } feetSprite.color = feetColor; path = animUtils.backFeetName((int)enumOverrideFeet); animUtils.loadAnimationClip(path, isMale, "feet", "Animation/items/"); animUtils.customizeAnimationSet(animUtils.arrayOneObjectAnimationHandler, (int)enumOverrideFeet, "feet", theNPCAnimator); //load Hand aniamtion if (isMale) { enumOverrideHand = (AnimationCreaterUtils.enumHand)System.Enum.Parse(typeof(AnimationCreaterUtils.enumHand), enumOverrideHandMale.ToString()); } else { enumOverrideHand = (AnimationCreaterUtils.enumHand)System.Enum.Parse(typeof(AnimationCreaterUtils.enumHand), enumOverrideHandFemale.ToString()); } handSprite.color = handColor; path = animUtils.backHandName((int)enumOverrideHand); animUtils.loadAnimationClip(path, isMale, "hand", "Animation/items/"); animUtils.customizeAnimationSet(animUtils.arrayOneObjectAnimationHandler, (int)enumOverrideHand, "hand", theNPCAnimator); //load Head aniamtion if (isMale) { enumOverrideHead = (AnimationCreaterUtils.enumHead)System.Enum.Parse(typeof(AnimationCreaterUtils.enumHead), enumOverrideHeadMale.ToString()); } else { enumOverrideHead = (AnimationCreaterUtils.enumHead)System.Enum.Parse(typeof(AnimationCreaterUtils.enumHead), enumOverrideHeadFemale.ToString()); } headSprite.color = headColor; path = animUtils.backHeadName((int)enumOverrideHead); animUtils.loadAnimationClip(path, isMale, "head", "Animation/items/"); animUtils.customizeAnimationSet(animUtils.arrayOneObjectAnimationHandler, (int)enumOverrideHead, "head", theNPCAnimator); //load Legs aniamtion if (isMale) { enumOverrideLegs = (AnimationCreaterUtils.enumLegs)System.Enum.Parse(typeof(AnimationCreaterUtils.enumLegs), enumOverrideLegsMale.ToString()); } else { enumOverrideLegs = (AnimationCreaterUtils.enumLegs)System.Enum.Parse(typeof(AnimationCreaterUtils.enumLegs), enumOverrideLegsFemale.ToString()); } legsSprite.color = legsColor; path = animUtils.backLegsName((int)enumOverrideLegs); animUtils.loadAnimationClip(path, isMale, "legs", "Animation/items/"); animUtils.customizeAnimationSet(animUtils.arrayOneObjectAnimationHandler, (int)enumOverrideLegs, "legs", theNPCAnimator); //load Neck aniamtion if (isMale) { enumOverrideNeck = (AnimationCreaterUtils.enumNeck)System.Enum.Parse(typeof(AnimationCreaterUtils.enumNeck), enumOverrideNeckMale.ToString()); } else { enumOverrideNeck = (AnimationCreaterUtils.enumNeck)System.Enum.Parse(typeof(AnimationCreaterUtils.enumNeck), enumOverrideNeckFemale.ToString()); } neckSprite.color = neckColor; path = animUtils.backNeckName((int)enumOverrideNeck); animUtils.loadAnimationClip(path, isMale, "neck", "Animation/items/"); animUtils.customizeAnimationSet(animUtils.arrayOneObjectAnimationHandler, (int)enumOverrideNeck, "neck", theNPCAnimator); //load Waist aniamtion if (isMale) { enumOverrideWaist = (AnimationCreaterUtils.enumWaist)System.Enum.Parse(typeof(AnimationCreaterUtils.enumWaist), enumOverrideWaistMale.ToString()); } else { enumOverrideWaist = (AnimationCreaterUtils.enumWaist)System.Enum.Parse(typeof(AnimationCreaterUtils.enumWaist), enumOverrideWaistFemale.ToString()); } waistSprite.color = waistColor; path = animUtils.backWaistName((int)enumOverrideWaist); animUtils.loadAnimationClip(path, isMale, "waist", "Animation/items/"); animUtils.customizeAnimationSet(animUtils.arrayOneObjectAnimationHandler, (int)enumOverrideWaist, "waist", theNPCAnimator); }