本文整理汇总了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 ();
}
示例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;
}