예제 #1
0
    // Use this for initialization
    void Start()
    {
        Cursor.visible = false;
        if (FindSkin = GameObject.Find("WhatSkin"))
        {
            Skin       = FindSkin.GetComponent <WhatSkin>();
            ChosenSkin = Skin.getSkin();
        }

        spriteR = this.gameObject.GetComponent <SpriteRenderer>();
        sprites = Resources.LoadAll <Sprite>(spriteNames);


        Time.timeScale      = 1.0f;
        TimeToInvokeMenu    = Time.time;
        MenuPlayerTransform = new Vector2(this.transform.position.x, this.transform.position.y);
        position            = 0;
    }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        Cursor.visible = false;
        //Find WhatSkin
        if (FindSkin = GameObject.Find("WhatSkin"))
        {
            //Get the component and save it in Skin.
            Skin = FindSkin.GetComponent <WhatSkin>();
        }
        Time.timeScale      = 1.0f;
        TimeToInvokeMenu    = Time.time;
        MenuPlayerTransform = new Vector2(this.transform.position.x, this.transform.position.y);
        position            = 0;

        //Initialize ChosenSkin, the SpriteRenderer get the array of the sprites.
        ChosenSkin = 0;
        spriteR    = this.gameObject.GetComponent <SpriteRenderer>();
        //Resources.LoadAll<Sprites>(PathString) --> This line looks inside the folder Resources/PathString
        sprites = Resources.LoadAll <Sprite>(spriteNames);        // --> So here we are looking through Resources/Skins
    }
예제 #3
0
    // Use this for initialization
    void Start()
    {
        Cursor.visible = false;
        playerScale    = transform.localScale;
        // sets our default values for isLight and isRight;
        isLight = true;
        isRight = true;
        // get our rigid body component
        rb = GetComponent <Rigidbody2D>();
        //Find the camera
        camera = FindObjectOfType <LightDark>();
        // get our audio source
        AudioSource = GetComponent <AudioSource>();

        direction = 1;
        //get our sprite renderer
        playerSprite = gameObject.GetComponent <SpriteRenderer>();


        if (FindSkin = GameObject.Find("WhatSkin"))
        {
            Skin       = FindSkin.GetComponent <WhatSkin>();
            ChosenSkin = Skin.getSkin();
        }
        sprites = Resources.LoadAll <Sprite>(spriteNames);

        switch (ChosenSkin)
        {
        case 1:
            playerSprite.sprite = sprites[2];
            break;

        case 2:
            playerSprite.sprite = sprites[1];
            break;

        case 3:
            playerSprite.sprite = sprites[0];
            break;
        }
    }