// Use this for initialization void Start() { loader = FindObjectOfType(typeof(loadingScript)) as loadingScript; playerName = OuyaSDK.OuyaPlayer.player1; Hawes = GetComponent(typeof(CharacterController)) as CharacterController; startScript = FindObjectOfType(typeof(StartScript)) as StartScript; gui = FindObjectOfType(typeof(GUI_HUD)) as GUI_HUD; HandNull = GameObject.FindGameObjectWithTag("HandNull").transform; Character.renderer.material = HawesDiffuse; weaponInHand = 2; if (PlayerPrefs.GetString("currentWeapon") == "") { weaponInHand = 0; } else if (PlayerPrefs.GetString("currentWeapon") == "machete") { weaponInHand = 1; } else if (PlayerPrefs.GetString("currentWeapon") == "shotgun") { weaponInHand = 2; } else if (PlayerPrefs.GetString("currentWeapon") == "semiauto") { weaponInHand = 3; } weaponInHand = 1; LoadWeapon(); }
void Start() { loader = GetComponent(typeof(loadingScript)) as loadingScript; thisTransform = transform; player = FindObjectOfType(typeof(CharacterMaster)) as CharacterMaster; }
void Start() { theLoadingScript = GetComponent <loadingScript>(); theLoadingScript.loading.SetActive(false); theVolume = FindObjectOfType <VolumeManager>(); theVolume.VolumeChange(); }
void Awake() { OuyaSDK.registerMenuButtonUpListener(this); OuyaSDK.registerMenuAppearingListener(this); OuyaSDK.registerPauseListener(this); OuyaSDK.registerResumeListener(this); OuyaSDK.registerGetProductsListener(this); OuyaSDK.registerPurchaseListener(this); OuyaSDK.registerGetReceiptsListener(this); loader = this.GetComponent <loadingScript>(); }
// Use this for initialization void Start() { theLoadingScript = GetComponent <loadingScript>(); }
//Sets the instances to null when the application quits public void OnApplicationQuit() { instance = null; }
void Start() { gui = FindObjectOfType(typeof(GUI_HUD)) as GUI_HUD; loader = GetComponent(typeof(loadingScript)) as loadingScript; }
//Sets the instances to null when the application quits public void OnApplicationQuit() { instance=null; }
/* 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); }
void Start() { text = new UIText(textToolkit, "GhoulishFont", "GhoulishFont_0.png"); startScript = FindObjectOfType(typeof(StartScript)) as StartScript; loader = FindObjectOfType(typeof(loadingScript)) as loadingScript; character = FindObjectOfType(typeof(CharacterMaster)) as CharacterMaster; //DontDestroyOnLoad(this.gameObject); AmmoText = text.addTextInstance("Bullets: " + startScript.Ammunition.ToString(), 0, 0, textScaleFactor, 2, Color.white, UITextAlignMode.Left, UITextVerticalAlignMode.Middle); PickupAmount = text.addTextInstance("+20", 0, 0, textScaleFactor * 5, 2, Color.white, UITextAlignMode.Left, UITextVerticalAlignMode.Middle); PickupAmount.alphaTo(0.1f, 0, Easing.Quartic.easeIn); PickupAmount.hidden = true; LevelInstruc = text.addTextInstance("" + LvlInstructions, 0, 0, textScaleFactor, 2, Color.white, UITextAlignMode.Center, UITextVerticalAlignMode.Middle); LevelInstruc.positionCenter(); LevelInstruc.alphaTo(0.01f, 0, Easing.Quartic.easeIn); StartCoroutine(StartLvlInstruction()); // buttons ------------------------------------ PauseBtn = UIButton.create(buttonUI, "PauseBtn.png", "PauseBtn.png", 0, 0, 10); PauseBtn.positionFromTopLeft(0.035f, 0.045f); PauseBtn.onTouchUpInside += onTouchPauseBtn; PauseBtn.touchDownSound = buttonSound; PauseBtn.hidden = false; PlayBtn = UIButton.create(buttonUI, "PlayBtn.png", "PlayBtn.png", 0, 0, 10); PlayBtn.positionFromCenter(0.2f, -0.21f); PlayBtn.onTouchUpInside += onTouchPlayBtn; PlayBtn.touchDownSound = buttonSound; PlayBtn.hidden = true; RetryBtn = UIButton.create(buttonUI, "RetryBtn.png", "RetryBtn.png", 0, 0, 10); RetryBtn.positionFromCenter(0.2f, -0.07f); RetryBtn.onTouchUpInside += onTouchRetryBtn; RetryBtn.touchDownSound = buttonSound; RetryBtn.hidden = true; QuitBtn = UIButton.create(buttonUI, "QuitBtn.png", "QuitBtn.png", 0, 0, 10); QuitBtn.positionFromCenter(0.2f, 0.07f); QuitBtn.onTouchUpInside += onTouchQuitBtn; QuitBtn.touchDownSound = buttonSound; QuitBtn.hidden = true; //------TOGGLE BTNS------------------------------- AudioBtn = UIToggleButton.create(buttonUI, "AudioOffBtn.png", "AudioBtn.png", "AudioOffBtn.png", 0, 0, 10); AudioBtn.positionFromCenter(0.2f, 0.21f); AudioBtn.onToggle += onTouchAudioBtn; AudioBtn.hidden = true; if (PlayerPrefs.GetInt("volume") == 1) { AudioBtn.selected = true; } //-------------------HEALTH METER-------------------------------------- HealthBG = buttonUI.addSprite("HealthBG.png", 0, 0, 10); HealthBG.positionFromCenter(-0.41f, 0.0f); HealthBar = UIProgressBar.create(buttonUI, "HealthBar.png", 0, 0, false, 5, false); Vector2 tempVec; tempVec = new Vector2(HealthBG.position.x + 95, HealthBG.position.y - 10); HealthBar.position = tempVec; HealthBar.value = 1; //----------------------PICKUPS------------------------- HealthPickup = buttonUI.addSprite("HeartPickup.png", 0, 0, 10); HealthPickup.positionFromCenter(-0.0f, 0.0f); HealthPickup.alphaTo(0.1f, 0, Easing.Quartic.easeIn); HealthPickup.hidden = true; AmmoPickup = buttonUI.addSprite("AmmoPickup.png", 0, 0, 10); AmmoPickup.positionFromCenter(-0.0f, 0.0f); AmmoPickup.alphaTo(0.1f, 0, Easing.Quartic.easeIn); AmmoPickup.hidden = true; //-----------------------------CONTROLS------------------------------------------ LToggle = UIJoystick.create(buttonUI, "LToggle.png", new Rect(Screen.width * 0.01f, Screen.height * 0.45f, Screen.width * 0.4f, Screen.height * 0.6f), Screen.width * 0.175f, Screen.height * -0.3f); LToggle.deadZone = new Vector2(0.8f, 0.8f); //LToggle.setJoystickHighlightedFilename( "LToggleT.png" ); AttackBtn = UIContinuousButton.create("AttackBtn.png", "AttackBtn.png", 0, 0); AttackBtn.positionFromBottomRight(0.05f, 0.05f); AttackBtn.centerize(); // centerize the button so we can scale it from the center AttackBtn.highlightedTouchOffsets = new UIEdgeOffsets(30); AttackBtn.onTouchIsDown += onTouchAttackBtn; AttackBtn.onTouchUpInside += onTouchAttackBtnUp; if (loader != null) { if (loader.ControllerCount > 0) { LToggle.hidden = true; AttackBtn.hidden = true; } } }