Beispiel #1
0
        //-------------------------------------------------------------------------
        public void create(uint et_player_rpcid, int bullet_objid, int bullet_vibid, float bullet_speed,
                           int locked_fish_obj_id, EbVector3 turret_pos, float turret_angle, TbDataParticle hit_particle)
        {
            // vib
            mPlayerId        = et_player_rpcid;
            mVibBullet       = EbDataMgr.Instance.getData <TbDataBullet>(bullet_vibid);
            mPos             = turret_pos;
            mfAngle          = turret_angle;
            mBulletObjId     = bullet_objid;
            mLockedFishObjid = locked_fish_obj_id;
            //mfBulletSpeed = mVibBullet.Speed;
            mfBulletSpeed = bullet_speed;

            // sprite bullet
            CRenderTurret turret      = mScene.getTurret(mPlayerId);
            int           turret_id   = turret.getTurretId();
            string        bullet_anim = mVibBullet.Bullet0Animation;

            if (turret.isPower())
            {
                bullet_anim = mVibBullet.ColorBulletAnimation;
            }
            else
            {
                switch (turret_id)
                {
                case 1:
                    bullet_anim = mVibBullet.Bullet1Animation;
                    break;

                case 2:
                    bullet_anim = mVibBullet.Bullet2Animation;
                    break;

                case 3:
                    bullet_anim = mVibBullet.Bullet3Animation;
                    break;

                case 4:
                    bullet_anim = mVibBullet.Bullet4Animation;
                    break;

                case 5:
                    bullet_anim = mVibBullet.Bullet5Animation;
                    break;

                case 6:
                    bullet_anim = mVibBullet.Bullet6Animation;
                    break;
                }
            }
            mBulletAnim   = bullet_anim;
            mSpriteBullet = new CSpriteBullet();
            mSpriteBullet.create(mScene, this, mBulletAnim, hit_particle);
            mSpriteBullet.setTrigger(true, 200);

            mSpriteBullet.setPosition(mPos);
            mSpriteBullet.setDirection(mfAngle);
            mSpriteBullet.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.Bullet));
            mSpriteBullet.setScale((float)mVibBullet.BulletHeight / (float)mVibBullet.BulletPixelHeight);
            mScene.getLevel().addBullet(this);
        }