Exemple #1
0
    // Use this for initialization
    void Start()
    {
        game = FindObjectOfType(typeof(SpacePod)) as SpacePod;
        float randomY = Random.Range(-5f, 5f);

        transform.position = new Vector3(15, randomY, 0);
        GameObject MyObject = Instantiate(game.ObstacleObject) as GameObject;

        MyObject.transform.position = transform.position;
        transform.parent            = MyObject.transform;
    }
    void OnTriggerEnter2D(Collider2D collider)
    {
        Ball ball = collider.gameObject.GetComponent <Ball> ();

        if (ball != null)
        {
            //change ();
            SpacePod game = FindObjectOfType(typeof(SpacePod)) as SpacePod;
            game.PaddlePhase = 2;
            game.FinishPaddle();
        }
    }
Exemple #3
0
    //Game gamescript = game.GetComponent<Game>();
    // Use this for initialization
    void Start()
    {
        game         = GameObject.FindObjectOfType(typeof(SpacePod)) as SpacePod;
        spriterender = GetComponent <SpriteRenderer>();

        int togglesound = PlayerPrefs.GetInt("SoundToggle");

        if (togglesound == 0)
        {
            GetComponent <AudioSource> ().mute = true;
        }
    }
Exemple #4
0
 // Use this for initialization
 void Start()
 {
     game = FindObjectOfType(typeof(SpacePod)) as SpacePod;
     transform.SetParent(game.transform);
     WeaveRand = UnityEngine.Random.Range(.5f, 1.5f);
 }