//显示一个一开始沿直线运动进入屏幕,然后在屏幕某一点停住的敌人 /* prefab: 构造敌人用到的prefab ** count: 显示的敌人的数量 ** birthPosition:敌人出现的位置 ** anchorPoint:敌人停驻的位置 */ private void ShowEnterAnchorEnemies(GameObject prefab, int count, Vector3 birthPosition, Vector3 anchorPoint, float speed = 1f, BulletType type = BulletType.LAZER_BULLET) { MovementArg arg = new MovementArg(); arg.positionArg = anchorPoint; arg.speed = speed; arg.bulletType = type; arg.type = MovementType.ENTER_ANCHOR_MOVEMENT; GenerateEnemyHelpr.GenerateEnterAnchorEnemies(prefab, count, birthPosition, arg, enemyParent, this); }
//一下三个方法为创建并显示一个特定类型的敌人,包装后可以方便其他组员编写其各自的关卡逻辑 //显示一个运动路线为直线的敌人(水平,垂直或者斜线) //根据birthPosition和direction可以确定运动的轨迹(两点确定一条直线) /* prefab: 构造敌人用到的prefab ** count: 显示的敌人的数量 ** birthPosition:敌人出现的位置 ** direction: 敌人运动的方向,与birthPosition共同确定 */ private void ShowLineMovementEnemies(GameObject prefab, int count, Vector3 birthPosition, Vector3 direction, float speed = 1f, BulletType type = BulletType.LAZER_BULLET) { MovementArg arg = new MovementArg(); arg.positionArg = direction; arg.speed = speed; arg.bulletType = type; arg.type = MovementType.LINE_MOVEMENT; GenerateEnemyHelpr.GenerateLineEnemies(prefab, count, birthPosition, arg, enemyParent, this); }
//显示一个按照V字形运动的敌人:先直线进入屏幕,然后停住一段时间,然后再按照另一条直线离开屏幕 /* prefab: 构造敌人用到的prefab ** count: 显示的敌人的数量 ** birthPosition:敌人出现的位置 ** turningPoint: 敌人停驻的位置 ** anchorTime:敌人停驻的时间长短 */ private void ShowVeeMovementEnemies(GameObject prefab, int count, Vector3 birthPosition, Vector3 turningPoint, float anchorTime, float speed = 1f, BulletType type = BulletType.LAZER_BULLET) { MovementArg arg = new MovementArg(); arg.positionArg = turningPoint; arg.anchorTime = anchorTime; arg.speed = speed; arg.bulletType = type; arg.type = MovementType.VEE_MOVEMENT; GenerateEnemyHelpr.GenerateVeeEnemies(prefab, count, birthPosition, arg, enemyParent, this); }