//------------------------------------------------------------------------- public override void load(EbPropSet prop_set) { Name = prop_set.getPropString("T_Name").get(); var prop_state = prop_set.getPropInt("I_State"); State = prop_state == null ? DataState.Default : (DataState)prop_state.get(); BulletCount = prop_set.getPropInt("I_BulletCount").get(); Bullet = EbDataMgr.Instance.getData <TbDataBullet>(prop_set.getPropInt("I_Bullet").get()); }
//------------------------------------------------------------------------- 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); }
//------------------------------------------------------------------------- void _hitFish(CRenderFish render_fish) { if (render_fish == null || render_fish.IsDie) { return; } uint et_player_rpcid = mBullet.getPlayerId(); if (mBullet.getScene().getMyPlayerId() == et_player_rpcid) { mBullet.getScene().getProtocol().c2sFishHit(et_player_rpcid, mBullet.getBulletObjId(), render_fish.FishObjId); } mBullet.signDestroy(); mIsSignDestroy = true; CRenderTurret turret = mBullet.getScene().getTurret(et_player_rpcid); if (turret == null) { return; } TbDataTurret vib_turret = turret.getVibTurret(); Dictionary <string, object> map_param = new Dictionary <string, object>(); map_param.Add("SourcePosition", getHitPosition(render_fish.Position, mBullet.getPosition())); map_param["NetColor"] = mBullet.getScene().getTurret(et_player_rpcid).getTurretColor(); map_param["PlayerId"] = et_player_rpcid; map_param["BulletHitFish"] = render_fish; TbDataBullet buttlt_data = mBullet.getBulletData(); mBullet.getScene().addEffect(buttlt_data.EffectCompose.Id, map_param, EffectTypeEnum.Client); if (!string.IsNullOrEmpty(mHitParticle.ParticlePrefabName)) { StillParticle particle = mScene.getParticlemanager().newParticle(mHitParticle.ParticlePrefabName); particle.setPosition(getHitPosition(render_fish.Position, mBullet.getPosition())); particle.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.FishHitParticle)); } }
//------------------------------------------------------------------------- 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); }