예제 #1
0
 // Use this for initialization
 void Start()
 {
     gameController = GameObject.Find ("GameScripts").GetComponent<Game> ();
     Lives.ship = this;
     col = this.GetComponent<PolygonCollider2D> ();
     mesh = this.GetComponent<MeshRenderer> ();
 }
예제 #2
0
        // Use this for initialization
        void Start()
        {
            button = this.gameObject;
            gameController = GameObject.Find ("GameScripts").GetComponent<Game> ();

            RestartToggle (false);
        }
예제 #3
0
 void Start()
 {
     gameController = GameObject.Find ("GameScripts").GetComponent<Game> ();
     gameController.guiController = this;
 }
예제 #4
0
        // Use this for initialization
        void Start()
        {
            //Set the Gui
            guiController = GameObject.Find ("GameScripts").GetComponent<GuiController> ();
            gameController = GameObject.Find ("GameScripts").GetComponent<Game> ();

            //check the type
            Type_Check ();

            //if its not a large, register it
            if (rockType != "L")
            {
                if (Application.loadedLevel == 1)
                gameController.asteroids++;
            }

            // initialize random direction, speed and rotation
            rotationSpeed = Random.Range (30, 80);
            movementSpeed = Random.Range (30, 80);

            // set the direction based on the type of rock
            if(rockType == "L")
            {
                direction = new Vector2 (Random.Range (-1f, 1f), Random.Range (-1f, 1f));
            }

            //set the velocity
            this.rigidbody2D.velocity = ((direction*movementSpeed) * Time.deltaTime);

            //set the rotation
            this.rigidbody2D.AddTorque(rotationSpeed * Time.deltaTime);
        }