Ejemplo n.º 1
0
    //Use this for initialization
    void Start()
    {
        //Finds the player (AAJ)
        playerBody = GameObject.FindGameObjectWithTag("Player").GetComponent <Rigidbody2D>();

        //Finds the player portrait (AAJ)
        playerPortrait = GameObject.FindGameObjectWithTag("Player Portrait") as GameObject;

        //Gets the player's player object for managing health (AAJ)
        playerObjects = this.GetComponent <PlayerObjects>();

        //Finds the bank (AAJ)
        bank = GameObject.FindGameObjectWithTag("Bank").GetComponent <Bank_Script>();

        //If there is no player target, the default mouse will display (AAJ)
        if (playerTarget != null)
        {
            //Removes the mouse so the target can take its place (AAJ)
            Cursor.visible = false;

            //Locks the cursor to the game (AAJ)
            Cursor.lockState = CursorLockMode.Confined;
        }//if

        //Prevents the physics engine from rotating the playerbody (AAJ)
        playerBody.freezeRotation = true;
    }//start
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        //Finds the bank (AAJ)
        bank = GameObject.FindGameObjectWithTag("Bank").GetComponent <Bank_Script>();

        //Initializes the movement vectors (AAJ)
        moveLeft     = new Vector2(-0.5f, -0.5f);
        moveRight    = new Vector2(0.5f, -0.5f);
        moveStraight = new Vector2(0.0f, -0.5f);

        //Moves the meteor forward (AAJ)
        if (moveForward == true)
        {
            this.GetComponent <Rigidbody2D>().AddForce(moveStraight, ForceMode2D.Impulse);
        }//if
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        //Gets the player (AAJ)
        player = GameObject.FindGameObjectWithTag("Player");

        //Gets the player portrait and its backgrounds (AAJ)
        playerPortrait = GameObject.FindGameObjectWithTag("Player Portrait");

        //Finds the bank (AAJ)
        bank = GameObject.FindGameObjectWithTag("Bank").GetComponent <Bank_Script>();

        //Gets the backgrounds if the player portrait exists (AAJ)
        if (playerPortrait != null)
        {
            pinkBackground = playerPortrait.transform.GetChild(0).GetComponent <SpriteRenderer>();
            blueBackground = playerPortrait.transform.GetChild(1).GetComponent <SpriteRenderer>();
        } //if
    }     //start