public static void EnemyFrozen(float speed) { //将不在同一维度的敌人冰封起来 for (int i = 0; i < Master.bodyCollector.Count; i++) { humanBody tempBody = Master.bodyCollector[i]; if (tempBody.GetComponent <AIController>() != null) //为敌人 { if (tempBody.tenetDirection == 0) { tempBody.GetAnimator().SetFloat("Speed", speed); } } } }
public void CalculateEnemy() { Master.totalEnemyNum = 0; //统计敌人 for (int i = 0; i < Master.bodyCollector.Count; i++) { humanBody tempBody = Master.bodyCollector[i]; if (tempBody.GetComponent <AIController>() != null) { //表示有AI控件,所以是敌人,此时totalNum++ if (Master.currentDirection == 1) { if (tempBody.tenetDirection == Master.currentDirection) //在正向时则被标记的反向敌人不算在敌人总数中 { Master.totalEnemyNum++; } } if (Master.currentDirection == 0) //反向时所有敌人都添加 { Master.totalEnemyNum++; } } } //进入逆转门后每个dead为true的敌人都可以加killedNum; Master.killedEnemyNum = 0; if (Master.currentDirection == 1) { //正常时死亡的人数,当cd变为0时这个值变为固定值 for (int i = 0; i < Master.bodyCollector.Count; i++) { humanBody tempBody = Master.bodyCollector[i]; if (tempBody.GetComponent <AIController>() != null) //为敌人 { if (tempBody.tenetDirection == 1) { if (tempBody.GetAnimator().GetBool("dead") == true) { Master.killedEnemyNum++; } } } } } if (Master.currentDirection == 0) { //逆转时死亡的人数 for (int i = 0; i < Master.bodyCollector.Count; i++) { humanBody tempBody = Master.bodyCollector[i]; if (tempBody.GetComponent <AIController>() != null) //为敌人 { if (tempBody.tenetDirection == 0) { if (tempBody.GetAnimator().GetBool("dead") == true) { Master.killedEnemyNum++; } } } } } Master.killedEnemyNum += Master.stageKilliedNum; //如果在逆转阶段则加上之前的数量 //Debug.Log(Master.killedEnemyNum + " " + Master.totalEnemyNum); }