Ejemplo n.º 1
0
        //-------------------------------------------------------------------------
        void _loadSeaStar(int map_id)
        {
            TbDataMap data = EbDataMgr.Instance.getData <TbDataMap>(map_id);

            foreach (var it in data.SeaStarParticle)
            {
                try
                {
                    if (it.TbDataParticle == null || it.TbDataParticle.Id == 0)
                    {
                        continue;
                    }

                    StillParticle still_particle = mScene.getParticlemanager().newParticle(it.TbDataParticle.ParticlePrefabName);
                    still_particle.setPosition(new EbVector3(it.PositionX, it.PositionY, 0));
                    still_particle.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.StarFish));

                    mSeaStar.Add(still_particle);

#if UNITY_EDITOR
                    still_particle.gameObject.name = "TkSpriteSeaStar_" + it.TbDataParticle.ParticlePrefabName;
#endif
                }
                catch (Exception e)
                {
                    Debug.LogWarning(e);
                }
            }
        }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------
        public StillParticle newParticle(string particle_prefab_name)
        {
            //Debug.LogWarning(particle_prefab_name);
            UnityEngine.Object particle_prefab_object = Resources.Load("Game/Particle/" + particle_prefab_name);

            if (particle_prefab_object == null)
            {
                Debug.LogError("ParticleManager::newParticle:: " + particle_prefab_name + " does not exist.");
            }

            GameObject    particle_object = GameObject.Instantiate(particle_prefab_object) as GameObject;
            StillParticle still_particle  = particle_object.GetComponent <StillParticle>();

            if (still_particle == null)
            {
                still_particle = particle_object.AddComponent <StillParticle>();
            }

            still_particle.init();

            if (!mDciParticle.ContainsKey(particle_prefab_name))
            {
                mDciParticle.Add(particle_prefab_name, new List <StillParticle>());
            }
            mDciParticle[particle_prefab_name].Add(still_particle);

#if UNITY_EDITOR
            still_particle.gameObject.name  = "TkParticle_" + particle_prefab_name;
            still_particle.transform.parent = mTKGameObject.transform;
#endif

            return(still_particle);
        }
Ejemplo n.º 3
0
 //-------------------------------------------------------------------------
 void _distroyTurnplateParticle()
 {
     if (mStillParticle != null)
     {
         mScene.getParticlemanager().freeParticle(mStillParticle);
         mStillParticle = null;
     }
 }
Ejemplo n.º 4
0
 //-------------------------------------------------------------------------
 public void freeParticle(StillParticle still_particle)
 {
     if (still_particle == null) return;
     still_particle.destroy();
     foreach (var it in mDciParticle)
     {
         it.Value.Remove(still_particle);
     }
 }
Ejemplo n.º 5
0
        //-------------------------------------------------------------------------
        public void setAim(CRenderFish lock_fish)
        {
            if (mCRenderTurret.getVibTurret().AimParticle.Id <= 0)
            {
                return;
            }

            StillParticle still_particle = mScene.getParticlemanager().newParticle(mCRenderTurret.getVibTurret().AimParticle.ParticlePrefabName);

            mAimParticle = new AimParticle(lock_fish, still_particle);
        }
Ejemplo n.º 6
0
 //-------------------------------------------------------------------------
 void _newParticle(EbVector3 position, int fish_vib_id)
 {
     if (mParticleMax < 0)
     {
         return;
     }
     --mParticleMax;
     mStillParticle = mScene.getParticlemanager().newParticle(mEffectAOEData.ParticleName.ParticlePrefabName);
     mStillParticle.setPosition(position);
     mStillParticle.setLayer(mScene.getLayerAlloter().getFishLayer(fish_vib_id));
 }
Ejemplo n.º 7
0
 //-------------------------------------------------------------------------
 public void freeParticle(StillParticle still_particle)
 {
     if (still_particle == null)
     {
         return;
     }
     still_particle.destroy();
     foreach (var it in mDciParticle)
     {
         it.Value.Remove(still_particle);
     }
 }
Ejemplo n.º 8
0
        //-------------------------------------------------------------------------
        public void display(int score, TbDataParticle particle_data)
        {
            if (score <= 0) return;

            mSpriteNumber.create(score, 100, mPosition, mAngle + mCurrentAngle);

            mStillParticle = mScene.getParticlemanager().newParticle(particle_data.ParticlePrefabName);
            mStillParticle.setPosition(mPosition);
            mStillParticle.setLooping(false);
            mStillParticle.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.TurretScoreBg));

            mIsDisplay = true;
            initRotate();
        }
Ejemplo n.º 9
0
        //-------------------------------------------------------------------------
        public void display(int score, TbDataParticle particle_data)
        {
            if (score <= 0)
            {
                return;
            }

            mSpriteNumber.create(score, 100, mPosition, mAngle + mCurrentAngle);

            mStillParticle = mScene.getParticlemanager().newParticle(particle_data.ParticlePrefabName);
            mStillParticle.setPosition(mPosition);
            mStillParticle.setLooping(false);
            mStillParticle.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.TurretScoreBg));

            mIsDisplay = true;
            initRotate();
        }
Ejemplo n.º 10
0
        //-------------------------------------------------------------------------
        void _particleFixedTarget(StillParticle still_particle, TbDataFish.ParticleDataStruct particle_data, uint et_player_rpcid)
        {
            CRenderTurret turret         = mScene.getTurret(et_player_rpcid);
            EbVector3     start_position = EbVector3.Zero;

            if (particle_data.StartPoint.ParticlePointType == TbDataFish.ParticlePointStruct.ParticlePointTypeEnum.Fish)
            {
                start_position = mCRenderFish.Position;
            }
            else if (particle_data.StartPoint.ParticlePointType == TbDataFish.ParticlePointStruct.ParticlePointTypeEnum.Fixed)
            {
                start_position = new EbVector3(particle_data.StartPoint.x, particle_data.StartPoint.y, 0);
            }

            still_particle.setRoute(RouteHelper.buildLineRoute(
                                        start_position, new EbVector3(particle_data.TargetPoint.x, particle_data.TargetPoint.y, 0)), 200);
        }
Ejemplo n.º 11
0
        //-------------------------------------------------------------------------
        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));
            }
        }
Ejemplo n.º 12
0
        //-------------------------------------------------------------------------
        void _particleNoneTarget(StillParticle still_particle, TbDataFish.ParticleDataStruct particle_data, uint et_player_rpcid)
        {
            if (particle_data.StartPoint.ParticlePointType == TbDataFish.ParticlePointStruct.ParticlePointTypeEnum.Fish)
            {
                if (particle_data.ParticleProduceTime == TbDataFish.ParticleProduceTimeEnum.FishMoving)
                {
                    mListParticle.Add(still_particle);//跟随鱼运动
                }
                else
                {
                    still_particle.setPosition(mCRenderFish.Position);
                    still_particle.setLooping(false);
                }
            }
            else if (particle_data.StartPoint.ParticlePointType == TbDataFish.ParticlePointStruct.ParticlePointTypeEnum.Fixed)
            {
                still_particle.setPosition(new EbVector3(particle_data.StartPoint.x, particle_data.StartPoint.y, 0));
            }

            _setOffsetLocation(still_particle, particle_data.StartPoint.x, particle_data.StartPoint.y);
        }
Ejemplo n.º 13
0
        //-------------------------------------------------------------------------
        StillParticle _buildParticle(TbDataFish.ParticleDataStruct particle_data, uint et_player_rpcid)
        {
            StillParticle still_particle = mParticlemanager.newParticle(particle_data.TbDataParticle.ParticlePrefabName);

            if (particle_data.TargetPoint.ParticlePointType == TbDataFish.ParticlePointStruct.ParticlePointTypeEnum.None ||
                particle_data.TargetPoint.ParticlePointType == TbDataFish.ParticlePointStruct.ParticlePointTypeEnum.Default)
            {
                _particleNoneTarget(still_particle, particle_data, et_player_rpcid);
            }
            else if (particle_data.TargetPoint.ParticlePointType == TbDataFish.ParticlePointStruct.ParticlePointTypeEnum.Turret)
            {
                _particleTurretTarget(still_particle, particle_data, et_player_rpcid);
            }
            else if (particle_data.TargetPoint.ParticlePointType == TbDataFish.ParticlePointStruct.ParticlePointTypeEnum.Fixed)
            {
                _particleTurretTarget(still_particle, particle_data, et_player_rpcid);
            }

            still_particle.setLayer(mScene.getLayerAlloter().getFishLayer(mFishData.Id));

            return(still_particle);
        }
Ejemplo n.º 14
0
        //-------------------------------------------------------------------------
        public void fishCoins(uint et_player_rpcid)
        {
            if (null == mFishData.mCoinParticle.CointParticleData)
            {
                return;
            }
            if (mFishData.mCoinParticle.CointParticleData.Id <= 0)
            {
                return;
            }

            CRenderTurret turret = mScene.getTurret(et_player_rpcid);

            if (turret == null)
            {
                return;
            }

            string coin_particle_name = mFishData.mCoinParticle.CointParticleData.ParticlePrefabName;
            int    radius             = mFishData.mCoinParticle.Radius;
            int    coin_count         = mFishData.mCoinParticle.CointCount;

            if (radius <= 0)
            {
                radius = 30;
            }
            if (coin_count <= 0)
            {
                coin_count = 1;
            }

            float layer = mScene.getLayerAlloter().getLayer(_eLevelLayer.Coin);

            StillParticle still_particle = mParticlemanager.newParticle(coin_particle_name);

            still_particle.setLayer(layer);
            still_particle.create(mCRenderFish.Position.logic2pixel(), turret.getTurretPos().logic2pixel(), coin_count, layer);
        }
Ejemplo n.º 15
0
        //-------------------------------------------------------------------------
        void _particleNoneTarget(StillParticle still_particle, TbDataFish.ParticleDataStruct particle_data, uint et_player_rpcid)
        {
            if (particle_data.StartPoint.ParticlePointType == TbDataFish.ParticlePointStruct.ParticlePointTypeEnum.Fish)
            {
                if (particle_data.ParticleProduceTime == TbDataFish.ParticleProduceTimeEnum.FishMoving)
                {
                    mListParticle.Add(still_particle);//跟随鱼运动
                }
                else
                {
                    still_particle.setPosition(mCRenderFish.Position);
                    still_particle.setLooping(false);
                }
            }
            else if (particle_data.StartPoint.ParticlePointType == TbDataFish.ParticlePointStruct.ParticlePointTypeEnum.Fixed)
            {
                still_particle.setPosition(new EbVector3(particle_data.StartPoint.x, particle_data.StartPoint.y, 0));
            }

            _setOffsetLocation(still_particle, particle_data.StartPoint.x, particle_data.StartPoint.y);
        }
Ejemplo n.º 16
0
 //-------------------------------------------------------------------------
 public AimParticle(CRenderFish lock_fish, StillParticle still_particle)
 {
     mLockFish = lock_fish;
     mStillParticle = still_particle;
     mStillParticle.setLooping(false);
 }
Ejemplo n.º 17
0
 //-------------------------------------------------------------------------
 void _newParticle(EbVector3 position, int fish_vib_id)
 {
     if (mParticleMax < 0) return;
     --mParticleMax;
     mStillParticle = mScene.getParticlemanager().newParticle(mEffectAOEData.ParticleName.ParticlePrefabName);
     mStillParticle.setPosition(position);
     mStillParticle.setLayer(mScene.getLayerAlloter().getFishLayer(fish_vib_id));
 }
Ejemplo n.º 18
0
        //-------------------------------------------------------------------------
        void _particleTurretTarget(StillParticle still_particle, TbDataFish.ParticleDataStruct particle_data, uint et_player_rpcid)
        {
            CRenderTurret turret = mScene.getTurret(et_player_rpcid);
            if (turret == null) return;
            EbVector3 start_position = EbVector3.Zero;

            if (particle_data.StartPoint.ParticlePointType == TbDataFish.ParticlePointStruct.ParticlePointTypeEnum.Fish)
            {
                start_position = mCRenderFish.Position;
            }
            else if (particle_data.StartPoint.ParticlePointType == TbDataFish.ParticlePointStruct.ParticlePointTypeEnum.Fixed)
            {
                start_position = new EbVector3(particle_data.StartPoint.x, particle_data.StartPoint.y, 0);
            }

            still_particle.setRoute(RouteHelper.buildLineRoute(
                start_position + new EbVector3(particle_data.StartPoint.x, particle_data.StartPoint.y, 0),
                turret.getTurretPos() + new EbVector3(particle_data.TargetPoint.x, particle_data.TargetPoint.y, 0)), 200);
        }
Ejemplo n.º 19
0
 //-------------------------------------------------------------------------
 void _setOffsetLocation(StillParticle still_particle, float x, float y)
 {
     still_particle.setOffsetLocation(new EbVector3(x, y, 0));
 }
Ejemplo n.º 20
0
 //-------------------------------------------------------------------------
 void _distroyTurnplateParticle()
 {
     if (mStillParticle != null)
     {
         mScene.getParticlemanager().freeParticle(mStillParticle);
         mStillParticle = null;
     }
 }
Ejemplo n.º 21
0
 //-------------------------------------------------------------------------
 public AimParticle(CRenderFish lock_fish, StillParticle still_particle)
 {
     mLockFish      = lock_fish;
     mStillParticle = still_particle;
     mStillParticle.setLooping(false);
 }
Ejemplo n.º 22
0
 //-------------------------------------------------------------------------
 void _setOffsetLocation(StillParticle still_particle, float x, float y)
 {
     still_particle.setOffsetLocation(new EbVector3(x, y, 0));
 }