예제 #1
0
파일: Base.cs 프로젝트: ryanking13/papillon
    // try upgrade base
    public void upgradeBase(int upgradeType)
    {
        if (upgradeType == BASEUPGRADE.CRAFT)
        {
            Debug.Log(cm);
            if (cm.craft(BASEUPGRADE.CRAFT_UPGRADE[craftLevel], 1))
            {
                craftLevel++;
                gm.playSE("hammering");
                return;
            }

            // upgrade fail
            Recipe recipe = RecipeDatabase.findRecipe(BASEUPGRADE.CRAFT_UPGRADE[craftLevel]);
            string msg    = "";

            msg += "업그레이드를 위해 다음의 재료가 필요합니다. \n\n";

            List <RecipeElement> ingredients = recipe.getIngredients();
            foreach (RecipeElement e in ingredients)
            {
                msg += e.item.getName() + " x " + e.count.ToString() + "\n";
            }

            gm.showMessage(msg);
        }

        else if (upgradeType == BASEUPGRADE.CULTIVATE)
        {
            if (cm.craft(BASEUPGRADE.CULTIVATE_UPGRADE[cultivateLevel], 1))
            {
                cultivateLevel++;
                gm.playSE("hammering");
                return;
            }

            // upgrade fail
            Recipe recipe = RecipeDatabase.findRecipe(BASEUPGRADE.CULTIVATE_UPGRADE[cultivateLevel]);
            string msg    = "";

            msg += "업그레이드를 위해 다음의 재료가 필요합니다. \n\n";

            List <RecipeElement> ingredients = recipe.getIngredients();
            foreach (RecipeElement e in ingredients)
            {
                msg += e.item.getName() + " x " + e.count.ToString() + "\n";
            }

            gm.showMessage(msg);
        }
        else
        {
            return;
        }
    }
    public override void setDescriptee(GameObject descriptee)
    {
        int  type       = descriptee.GetComponent <UpgradeButton>().upgradeType;
        Base baseObject = GameManager.gm.getBoardManager().getBase();

        if (type == BASEUPGRADE.CRAFT)
        {
            int craftLevel = baseObject.getCraftLevel();
            name.text = "LV " + craftLevel.ToString();

            Recipe recipe = RecipeDatabase.findRecipe(BASEUPGRADE.CRAFT_UPGRADE[craftLevel]);
            string msg    = "";

            List <RecipeElement> ingredients = recipe.getIngredients();
            foreach (RecipeElement e in ingredients)
            {
                msg += e.item.getName() + " x " + e.count.ToString() + "\n";
            }

            description.text = msg;
        }
        else if (type == BASEUPGRADE.CULTIVATE)
        {
            int cultivateLevel = baseObject.getCraftLevel();
            name.text = "LV " + cultivateLevel.ToString();

            Recipe recipe = RecipeDatabase.findRecipe(BASEUPGRADE.CULTIVATE_UPGRADE[cultivateLevel]);
            string msg    = "";

            List <RecipeElement> ingredients = recipe.getIngredients();
            foreach (RecipeElement e in ingredients)
            {
                msg += e.item.getName() + " x " + e.count.ToString() + "\n";
            }

            description.text = msg;
        }
    }
예제 #3
0
    public void onClick()
    {
        if (cm.craft(1000, 1))
        {
            gm.playSE("hammering");
            map.setBase();
        }
        else
        {
            Recipe recipe = RecipeDatabase.findRecipe(1000);
            string msg    = "";

            msg += "다음의 재료가 필요합니다. \n\n";

            List <RecipeElement> ingredients = recipe.getIngredients();
            foreach (RecipeElement e in ingredients)
            {
                msg += e.item.getName() + " x " + e.count.ToString() + "\n";
            }

            gm.showMessage(msg);
        }
    }