예제 #1
0
    //getXXBullet()方法表示从池子中获取对象来使用,不同的对象有类似的方法,子弹的类型不同,可能需要不同的参数
    //获取子弹的时候会调用子弹对应的移动控制脚本中的 Init()方法,进行初始化设置
    public GameObject getCircleBullet(CircleBulletArg arg)
    {
        GameObject bullet = getBulletFrom(CircleBulletPond, circleBullet);

        bullet.SendMessage("Init", arg);
        return(bullet);
    }
예제 #2
0
 void Init(CircleBulletArg arg)
 {
     seqNumber = arg.seqNum;
     if (arg.isArc)
     {
         ArcMove(arg.unitAngle);
     }
     else
     {
         RightAngleMove();
     }
 }
예제 #3
0
    private IEnumerator FireRightAngleBulletsImpl(int countOfWaves)
    {
        for (int i = 0; i < countOfWaves; ++i)
        {
            for (int j = 0; j < 21; j++)
            {
                CircleBulletArg arg = new CircleBulletArg(j - 10, 0, false);
                arg.seqNum = j - 10;
                bulletsPond.getCircleBullet(arg).transform.position = bulletSlot.position;
            }

            yield return(new WaitForSeconds(0.5f));
        }
    }
예제 #4
0
 void Fire()
 {
     if (bulletType == BulletType.CIRCLE_BULLET)
     {
         CircleBulletArg arg = new CircleBulletArg(-1, 5, true);
         bulletsPond.getCircleBullet(arg).transform.position = weaponSlot.position;
         arg.seqNum = 1;
         bulletsPond.getCircleBullet(arg).transform.position = weaponSlot.position;
     }
     else
     {
         bulletsPond.getLazerBullet().transform.position = weaponSlot.position;
     }
 }
예제 #5
0
    private IEnumerator FireArcFormationBulletImpl(int count, int unitAngle, int countOfWaves)
    {
        int mid = count / 2;

        for (int i = 0; i < countOfWaves; ++i)
        {
            for (int j = 0; j < count; j++)
            {
                CircleBulletArg arg    = new CircleBulletArg(j - mid, unitAngle, true);
                GameObject      bullet = bulletsPond.getCircleBullet(arg);
                bullet.transform.position = bulletSlot.position;
            }

            yield return(new WaitForSeconds(0.5f));
        }
    }