Exemplo n.º 1
0
    /// <summary>
    /// Shoot one bullet.
    /// </summary>
    private void LockShoot()
    {
        // get the closest object's transform.
        JCS_DetectAreaObject dao = mDetectAreaAction.FindTheClosest();

        if (dao == null)
        {
            return;
        }

        JCS_Bullet bullet = mShootAction.Shoot();

        if (bullet == null)
        {
            return;
        }

        bullet.transform.LookAt(dao.transform);


        if (dao.transform.position.x < this.transform.position.x)
        {
            bullet.transform.Rotate(0, 90, 0);

            switch (mBFPlayer.Face)
            {
            case JCS_2DFaceType.FACE_LEFT:
                bullet.MoveSpeed = -bullet.MoveSpeed;
                break;

            case JCS_2DFaceType.FACE_RIGHT:

                break;
            }
        }
        else
        {
            bullet.transform.Rotate(0, -90, 0);

            switch (mBFPlayer.Face)
            {
            case JCS_2DFaceType.FACE_LEFT:

                break;

            case JCS_2DFaceType.FACE_RIGHT:
                bullet.MoveSpeed = -bullet.MoveSpeed;
                break;
            }
        }

        // redo the deviation effect, cuz we reset the angle
        // after we did the deviation effect.
        mShootAction.DeviationEffect(bullet.transform);
    }
Exemplo n.º 2
0
    public void ShootRainFall()
    {
        if (!mCanShoot)
        {
            return;
        }

        for (int count = 0; count < mShootAction.ShootCount; ++count)
        {
            JCS_Bullet bullet = mShootAction.Shoot();
            if (bullet != null)
            {
                bullet.transform.eulerAngles = new Vector3(0, 0, mShootAngle);
                mShootAction.DeviationEffect(bullet.transform);
            }
        }

        mShooted = true;
    }