Пример #1
0
    void SetPostion()
    {
        int x = Random.Range(0, Level.getMaxX() - 1);
        int y = Random.Range(0, Level.getMaxY() - 1);

        if (Level.CanSpawn(x, y))
        {
            mSpawnLocation = new Vector3(x, y, 0);
        }
        else
        {
            // recalls the function if it was unable to fins open pos
            SetPostion();
        }
    }