本文整理汇总了C#中Enemy.Spawn方法的典型用法代码示例。如果您正苦于以下问题:C# Enemy.Spawn方法的具体用法?C# Enemy.Spawn怎么用?C# Enemy.Spawn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enemy
的用法示例。
在下文中一共展示了Enemy.Spawn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Tick
void Tick()
{
int[] nEnemies;
RandomizeEnemies();
text.text = "";
for (int i = 0; i < 4; i++) {
object[] queue = arrEnemies[i].queue.ToArray();
if ( (int)queue[3] == 1 ) {
Enemy enemy = new Enemy();
arrEnemies[i].instances.Enqueue(enemy);
enemy.Spawn(i);
}
//
object[] instances = arrEnemies[i].instances.ToArray();
for (int j = 0; j < instances.Length; j++) {
Enemy enemy = (Enemy)instances[j];
enemy.Move();
}
}
// Now get the four enemies
nEnemies = AdvanceEnemies();
for (int i = 0; i < 4; i++) {
//
if (nEnemies[i] == 1 && IsSwipeKill(i)) {
// Correct swipe! Killed the enemy
text.text = ":) Enemy killed";
fTickTime -= fTickTime > 0.25f ? 0.05f : 0;
} else if (nEnemies[i] == 1 && !IsSwipeKill(i)) {
text.text = "You die!!";
bIsDeath = true;
}
//
if (nEnemies[i] == 1) {
// Enemy poped up
Enemy enemy = (Enemy) arrEnemies[i].instances.Dequeue();
enemy.Kill();
}
}
// Consume swipes
nSwipeX = 0;
nSwipeY = 0;
//
Debug.Log("-------------------");
for (int i = 0; i < 4; i++) {
object[] queue = arrEnemies[i].queue.ToArray();
Debug.Log( ((int)queue[0]).ToString() + " " + ((int)queue[1]).ToString() + " " + ((int)queue[2]).ToString() );
}
// 10/10 would invoke again
if (! bIsDeath ) {
Invoke("Tick", fTickTime);
}
}