Esempio n. 1
0
    // Check collisions
    void OnTriggerEnter2D(Collider2D collider)
    {
        // food?
        if (collider.name.StartsWith("FoodPrefab"))
        {
            ate = true;
            pointCounter.increment();
            Destroy(collider.gameObject);

            GameObject.Find("Main Camera").GetComponent <SpawnFood>().Spawn();
        }
        // if not food, must be border or self...
        else
        {
            alive = false;
        }
    }