Exemplo n.º 1
0
    void Start()
    {
        rb = GetComponent <Rigidbody2D>();
        rb.gravityScale = 0;

        Collider2D col1 = GetComponent <Collider2D>();
        Collider2D col2 = person.GetComponent <Collider2D>();

        Debug.Log(col2);

        if (col1.IsTouching(col2))
        {
            Debug.Log("touching now");
            Vector3 screenSize = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0));
            Vector3 spawnPos   = new Vector3(Random.Range(-screenSize.x, screenSize.x) * .9f,
                                             Random.Range(-screenSize.y * .7f, screenSize.y) * .9f, 0);
            transform.position = spawnPos;
        }

        _skyManager = FindObjectOfType <SkyManager>();

        // the image that gets darker as we lose stars
        _darker = FindObjectOfType <Darker>();

        _audioSource = gameObject.AddComponent <AudioSource>();
        fallFx       = Resources.Load <AudioClip>("Sounds/celestial1");
    }
Exemplo n.º 2
0
    void Start()
    {
        GenerateStars();
        fallenStars = new List <GameObject>();

        _darker      = FindObjectOfType <Darker>();
        _darker.time = 1 / (float)(numOfTotalStars);
    }