当前位置: 首页>>代码示例>>C#>>正文


C# Skill.onInstall方法代码示例

本文整理汇总了C#中Skill.onInstall方法的典型用法代码示例。如果您正苦于以下问题:C# Skill.onInstall方法的具体用法?C# Skill.onInstall怎么用?C# Skill.onInstall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Skill的用法示例。


在下文中一共展示了Skill.onInstall方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: install

    // Possibly need to add the progNumb value to the parameters so that it will not update as progNumb is updated??
    void install(Skill skill, int numProg, int numHard, int numRes)
    {
        print("Install");

        if (!rcReady)
        {
            Debug.Log("RunnerController not found yet");
            return;
        }

        if (skill.type == "Program" || skill.type == "program")
        {
            //print("it was a program");

            //TODO fix this
            if (progNumb < Programs.Count)
            {
                print("You have space for more programs!");
                Programs[numProg].name = skill.name;
                Programs[numProg].transform.GetChild(0).GetComponent<Text>().text = "X";
                Programs[numProg].onClick.AddListener(() => skill.effect());
                skill.onInstall();

                progNumb ++;
            }
            else
            {
                // Popup saying it can't be done!!
                Debug.Log("Popup and all that, but you gots no room left!");
            }
        }

        if (skill.type == "Hardware" || skill.type == "hardware")
        {
            // ATTACH TO hardware
            if (hardNumb < Hardware.Count)
            {
                print("You have space for more programs!");
                Hardware[numHard].name = skill.name;
                Hardware[numHard].transform.GetChild(0).GetComponent<Text>().text = "X";
                Hardware[numHard].onClick.AddListener(() => skill.effect());
                skill.onInstall();

                hardNumb++;
            }
            else
            {
                // Popup saying it can't be done!!
                Debug.Log("Popup and all that, but you gots no room left!");
            }
        }

        if (skill.type == "Resource" || skill.type == "resource")
        {
            // attach to resources
            if (resNumb < Resources.Count)
            {
                print("You have space for more programs!");
                Resources[numRes].name = skill.name;
                Resources[numRes].transform.GetChild(0).GetComponent<Text>().text = "X";
                Resources[numRes].onClick.AddListener(() => skill.effect());
                skill.onInstall();

                resNumb++;
            }
            else
            {
                // Popup saying it can't be done!!
                Debug.Log("Popup and all that, but you gots no room left!");
            }
        }

        if (skill.type == "Event" || skill.type == "event")
        {
            skill.effect();
        }
    }
开发者ID:robofriven,项目名称:Netrunner,代码行数:78,代码来源:skillHandler.cs


注:本文中的Skill.onInstall方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。