Beispiel #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> ();
 }
        // Use this for initialization
        void Start()
        {
            button = this.gameObject;
            gameController = GameObject.Find ("GameScripts").GetComponent<Game> ();

            RestartToggle (false);
        }
 void Start()
 {
     gameController = GameObject.Find ("GameScripts").GetComponent<Game> ();
     gameController.guiController = this;
 }
        // 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);
        }