Esempio n. 1
0
    // initialize dropItemList
    private void initItemList()
    {
        List <FieldDropDatabaseElement> list = FieldDropDatabase.load(this.type);

        foreach (FieldDropDatabaseElement e in list)
        {
            int objectCount = Mathf.Max(0, Random.Range(e.minObjectCount, e.maxObjectCount + 1));
            for (int i = 0; i < objectCount; i++)
            {
                int itemCount = Mathf.Max(0, Random.Range(e.minItemCount, e.maxItemCount + 1));
                dropItemList.Add(new FieldItemElement(e.id, itemCount));
            }
        }

        // YES THIS IS F*****G HARD-CODING!!

        /*
         * rocket 필드에는 우주선 구성에 필요한 6개 아이템이 있는데 (count가 0이라 필드 상에 표시되지는 않음)
         * 그 중 랜덤한 하나의 count를 -1로 지정해주고, 이것이 부족한 아이템이 된다
         */
        if (getType() == FIELDTYPE.ROCKET)
        {
            int randomIdx = Random.Range(0, dropItemList.Count);
            dropItemList[randomIdx].currentCount = -1;
        }
    }
Esempio n. 2
0
    private void initGame()
    {
        /*
         *  Initializing player
         *
         */
        player = new Player(100, 1000, 0, 100f);

        /*
         * Initializing Databases
         *
         */
        itemText   = Resources.Load("Data/Item") as TextAsset;
        recipeText = Resources.Load("Data/Recipe") as TextAsset;
        techText   = Resources.Load("Data/Technology") as TextAsset;

        ItemDatabase.init(itemText);
        RecipeDatabase.init(recipeText);
        TechnologyDatabase.init(techText);
        FieldDropDatabase.init();

        /*
         * Other Managers Initializing
         *
         * **CAUTION**
         * You must initialize managers after initializing databases, player
         * because initializing managers contain loading object, data from database, player
         * also, order of initializing managers also matters
         */

        researchManager = GetComponent <ResearchManager>();
        researchManager.init();

        // craftManager references researchManager
        craftManager = GetComponent <CraftManager>();
        craftManager.init();

        //
        boardManager = GetComponent <BoardManager>();
        boardManager.init();
        soundManager = GetComponentInChildren <SoundManager>();

        /*
         * Effect Processor Initializing
         * **CAUTION**
         * You must initialize this after all other initializing done
         */
        effectProcessor = new EffectProcessor();
        effectProcessor.init();

        ///*
        // * get Inventory
        // */

        //inventory = transform.Find("Canvas/InventoryPanel").gameObject;

        // default scene
        scene = SCENES.BASE;

        // game play variables initialize
        day            = 1;
        exploreChance  = true;
        moveChance     = true;
        researchChance = true;

        // start game
        SceneManager.LoadScene(scene);
    }