コード例 #1
0
    void collectBasic(resourceTypes resource, Theme proficience)
    {
        gameManager.GetComponent <MaterialManager>().updateBasicResources(resource, 1);

        float rand = Random.Range(0f, 10f);

        if (rand <= chanceOfGettingDecorationResources)
        {
            gameManager.GetComponent <MaterialManager>().updateDecorationResources(proficience, 1);
        }
    }
コード例 #2
0
ファイル: MaterialManager.cs プロジェクト: Sywooch/GGJ2019.1
    public void updateBasicResources(resourceTypes type, int quantity)
    {
        switch (type)
        {
        case resourceTypes.wood:
            wood += quantity;
            break;

        case resourceTypes.stone:
            stone += quantity;
            break;
        }
    }
コード例 #3
0
    public void OnPointerClick(PointerEventData eventData)
    {
        GameObject selectedCitizen = gameManager.GetComponent <GameManager>().SelectedCitizen;

        actions       act  = actions.getWood;
        resourceTypes type = resourceTypes.wood;

        if (selectedCitizen != null)
        {
            Theme proficience = selectedCitizen.GetComponent <CitizenBehaviour>().CitizenData.proficience;
            Debug.Log(proficience);
            switch (this.gameObject.tag)
            {
            case "WoodWay":
                Debug.Log("wood");
                act  = actions.getWood;
                type = resourceTypes.wood;
                break;

            case "StoneWay":
                Debug.Log("stone");
                act  = actions.getStone;
                type = resourceTypes.stone;
                break;

            case "DecorationWay":
                Debug.Log("decoration");
                act = actions.getDecoration;
                break;
            }
            if (act != null && type != null)
            {
                if (this.gameObject.tag == "DecorationWay")
                {
                    selectedCitizen.GetComponent <CitizenBehaviour>().SetTurnAction(
                        delegate() {
                        collectDecoration(proficience);
                    }, act);
                }
                else
                {
                    selectedCitizen.GetComponent <CitizenBehaviour>().SetTurnAction(
                        delegate() {
                        collectBasic(type, proficience);
                    }, act);
                }
            }
        }
    }