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


C# Level.setEnemies方法代码示例

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


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

示例1: createNew

    public Level createNew(Level best, Level pair)
    {
        Level next = new Level ();
        List<int[]> lp = new List<int[]> ();
        List<int[]> lc = new List<int[]> ();
        List<int[]> le = new List<int[]> ();
        int[] pPos;
        int[] fPos;

        int bestLineNumber = Mathf.FloorToInt(horizontalWalls * 0.7f);
        int pairLineNumber = Mathf.FloorToInt(horizontalWalls * 0.2f);
        int randomLineNumber = Mathf.FloorToInt(horizontalWalls * 0.1f);

        lp.AddRange (getNPositions (best.getLine (), bestLineNumber));
        lp.AddRange (getNPositions (pair.getLine (), pairLineNumber));
        lp.AddRange (getNPositonsRandom(randomLineNumber,true));

        int bestColumnNumber = Mathf.FloorToInt(verticalWalls * 0.7f);
        int pairColumnNumber = Mathf.FloorToInt(verticalWalls * 0.2f);
        int randomColumnNumber = Mathf.FloorToInt(verticalWalls * 0.1f);

        lc.AddRange (getNPositions (best.getCollum (), bestColumnNumber));
        lc.AddRange (getNPositions (pair.getCollum (), pairColumnNumber));
        lc.AddRange (getNPositonsRandom(randomColumnNumber,true));

        int bestEnemiesNumber = Mathf.FloorToInt(verticalWalls * 0.7f);
        int pairEnemiesNumber = Mathf.FloorToInt(verticalWalls * 0.2f);
        int randomEnemiesNumber = Mathf.FloorToInt(verticalWalls * 0.1f);

        le.AddRange (getNPositions (best.getEnemies (), bestEnemiesNumber));
        le.AddRange (getNPositions (pair.getEnemies (), pairEnemiesNumber));
        le.AddRange (getNPositonsRandom(randomEnemiesNumber,false));

        if (getFromBest ()) {
            pPos = best.getPlayerPos ();
        } else
        if (getFromPair ()) {
            pPos = pair.getPlayerPos ();
        } else
            pPos = getRandomBlock ();

        if (getFromBest ()) {
            fPos = best.getFinishPos ();
        } else
        if (getFromPair ()) {
            fPos = pair.getFinishPos ();
        } else
            fPos = getRandomBlock ();

        next.setPositions (pPos, fPos);

        next.setEnemies (le);

        next.setLines (lp, lc);

        currentLevel = next;

        return createAndTest ();
    }
开发者ID:KVKuhr,项目名称:UnityPCG,代码行数:59,代码来源:PCGLevelMaker.cs

示例2: createSeed

    //TODO
    private void createSeed()
    {
        Level chosen = new Level ();
        List<int[]> lp = new List<int[]> ();
        List<int[]> lc = new List<int[]> ();
        List<int[]> le = new List<int[]> ();

        for (int i = 0; i<horizontalWalls; i++) {

            int[] randomBlock = getRandomBlock ();
            int wallsize = (int)Random.Range (wallMinSize, wallMaxSize);

            int[] aux = {randomBlock [0],randomBlock [1],wallsize};
            lp.Add (aux);

        }

        for (int i = 0; i<verticalWalls; i++) {

            int wallsize = (int)Random.Range (wallMinSize, wallMaxSize);

            int[] randomBlock = getRandomBlock ();
            int[] aux1 = {randomBlock [0],randomBlock [1],wallsize};
            lc.Add (aux1);

        }

        for (int i = 0; i<numberOfEnemies; i++) {

            int[] randomBlock = getRandomBlock ();

            int[] aux2 = {randomBlock [0],randomBlock [1]};
            le.Add (aux2);
        }

        chosen.setPositions (getRandomBlock (), getRandomBlock ());

        chosen.setEnemies (le);

        chosen.setLines (lp, lc);

        currentLevel = chosen;
    }
开发者ID:KVKuhr,项目名称:UnityPCG,代码行数:44,代码来源:PCGLevelMaker.cs


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