예제 #1
0
    void createOrb(Hex h)
    {
        GameObject orbObject = new GameObject();
        Orb        newOrb    = orbObject.AddComponent <Orb> ();

        if (h.transform.position.x > Controller.WORLD_WIDTH / 3 + 3 || -1 * h.transform.position.x > Controller.WORLD_WIDTH / 3 + 4)
        {
            newOrb.init(h, 3, this);
        }
        else if (h.transform.position.y <= -4)
        {
            newOrb.init(h, UnityEngine.Random.Range(1, 3), this);
        }
        else if (h.transform.position.y > 4)
        {
            newOrb.init(h, UnityEngine.Random.Range(-1, 2), this);
        }
        newOrb.name = "Orb" + newOrb.type;
        orbs.Add(newOrb);
    }