Inheritance: MonoBehaviour
 void Awake()
 {
     movement 	= pc.GetComponent <CharacterMotor> ();
     message 	= text.GetComponent <uiSystem> ();
     cam 		= holder.GetComponent <cameraScript> ();
     menu 		= holder.GetComponent <menuScript> ();
 }
Exemple #2
0
    public void win()
    {
        wonGame = true;
        winText.SetActive(true);
        menuScript ms = GameObject.FindWithTag("Menu").GetComponent <menuScript>();

        ms.Restarting();
        Time.timeScale = 0;
    }
Exemple #3
0
 void Awake()
 {
     // Variables to hold the scripts on other game objects so that we can manipulate them from this script
     mouse 		= pc.GetComponent <MouseLook> ();
     movement 	= pc.GetComponent <CharacterMotor> ();
     cam 		= Camera.main.GetComponent <MouseLook> ();
     talk 		= pc.GetComponent <playerScript> ();
     menu 		= holder.GetComponent <menuScript> ();
     inventory 	= holder.GetComponent <cameraScript> ();
     message 	= text.GetComponent <uiSystem> ();
 }
Exemple #4
0
    void Awake()
    {
        if (!_instance)
        {
            _instance = this;
        }
        else
        {
            Destroy(this.backgroundmusic);
        }

        DontDestroyOnLoad(backgroundmusic);
    }
Exemple #5
0
    void Awake()
    {
        player 		= PC.GetComponent <playerScript> ();
        inv		 	= holder.GetComponent <cameraScript> ();
        m			= holder.GetComponent <menuScript> ();
        //badge 		= maria.GetComponent <mariaBehavior> ();

        if (Application.loadedLevel == 1)
        {
            key 		= npc.GetComponent <securityBehavior> ();
            badge 		= picture.GetComponent <pictureScript> ();
        }
    }
Exemple #6
0
    //Handle player Damage
    //To-do: player death
    public void takeDamage(int dmg)
    {
        rb2d.velocity = Vector2.zero;
        hp           -= dmg;
        setHpCounter();
        hurteffects();

        if (hp <= 0)
        {
            LoseText.SetActive(true);
            menuScript ms = GameObject.FindWithTag("Menu").GetComponent <menuScript>();
            ms.Restarting();
            Time.timeScale = 0;
        }
    }
    void Awake()
    {
        // Variables to hold the scripts on other game objects so that we can manipulate them from this script
        mouse 		= pc.GetComponent <MouseLook> ();
        movement 	= pc.GetComponent <CharacterMotor> ();
        cam 		= Camera.main.GetComponent <MouseLook> ();
        menu 		= this.GetComponent <menuScript> ();
        message 	= text.GetComponent <uiSystem> ();
        pic 		= picture.GetComponent <pictureScript> ();
        cursor		= gui.GetComponent <guiSystem> ();

        if (Application.loadedLevel == 3)
        {
            talk 	= SH.GetComponent <playerScript> ();
        }

        else
        {
            talk 	= pc.GetComponent <playerScript> ();
        }
    }
 void Awake()
 {
     // Variables to hold the scripts on other game objects so that we can manipulate them from this script
     cam 		= holder.GetComponent <cameraScript> ();
     //chosen 		= holder.GetComponent <timeChanger> ();
     menu 		= holder.GetComponent <menuScript> ();
     message 	= text.GetComponent <uiSystem> ();
     mouse 		= pc.GetComponent <MouseLook> ();
     look 		= Camera.main.GetComponent <MouseLook> ();
     movement 	= pc.GetComponent <CharacterMotor> ();
     info 		= this.GetComponent <displayInfo> ();
     talk 		= pc.GetComponent <playerScript> ();
     pic 		= picture.GetComponent <pictureScript> ();
     cursor 		= gui.GetComponent <guiSystem> ();
 }
Exemple #9
0
 void Awake()
 {
     // Variables to hold the scripts on other game objects so that we can manipulate them from this script
     cam 		= holder.GetComponent <cameraScript> ();
     //chosen 		= holder.GetComponent <timeChanger> ();
     menu 		= holder.GetComponent <menuScript> ();
     message 	= text.GetComponent <uiSystem> ();
     mouse 		= this.GetComponent <MouseLook> ();
     look 		= Camera.main.GetComponent <MouseLook> ();
     movement 	= this.GetComponent <CharacterMotor> ();
     talk 		= this.GetComponent <playerScript> ();
     core 		= Core.GetComponent <displayInfo> ();
     daphne		= Daphne.GetComponent <displayInfo> ();
     ic			= Core.GetComponent <icScript> ();
     scepter		= scepterBroken.GetComponent <displayInfo> ();
     okScepter	= Scepter.GetComponent <displayInfo> ();
     cursor		= gui.GetComponent <guiSystem> ();
 }
/*    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);
    }