Example #1
0
        //-------------------------------------------------------------------------
        public void create(CRenderScene scene, TbDataFish vib_fish_data)
        {
            mScene = scene;
            mVibFishData = vib_fish_data;
            mFishCycleGap = mScene.getLayerAlloter().EachFishGap / 10f;

            if (mVibFishData.Type == TbDataFish.FishType.Custom)
            {
                mCycle = mScene.getRenderObjectPool().newFishStillSprite();
                mCycle.init(this, scene);
                mCycle.playAnimation(mVibFishData.FishCompose.BackGroundAniName);
                mCycle.setScale((float)mVibFishData.FishCompose.BackGroundAnimationScale / 100.0f);
                foreach (var it in mVibFishData.FishCompose.FishComposes)
                {
                    if (null != it && it.Id > 0)
                    {
                        TbDataFish fish_data = EbDataMgr.Instance.getData<TbDataFish>(it.FishVibId);
                        FishStillSprite fish_sprite = mScene.getRenderObjectPool().newFishStillSprite();

                        fish_sprite.init(this, scene);
                        fish_sprite.playAnimation(fish_data.FishAnimMove);
                        fish_sprite.setScale(mFixFishScale * (float)fish_data.FishHeight / (float)fish_data.FishPixelHeight);

                        mFishs.Add(new FishSpriteAndOffset(
                            fish_sprite,
                            new EbVector3(it.OffsetX, it.OffsetY, 0),
                            fish_data.FishAnimDie));
                    }
                }
            }
        }
Example #2
0
        //-------------------------------------------------------------------------
        public void create(CRenderScene scene, TbDataFish vib_fish_data)
        {
            mScene        = scene;
            mVibFishData  = vib_fish_data;
            mFishCycleGap = mScene.getLayerAlloter().EachFishGap / 10f;

            if (mVibFishData.Type == TbDataFish.FishType.Custom)
            {
                mCycle = mScene.getRenderObjectPool().newFishStillSprite();
                mCycle.init(this, scene);
                mCycle.playAnimation(mVibFishData.FishCompose.BackGroundAniName);
                mCycle.setScale((float)mVibFishData.FishCompose.BackGroundAnimationScale / 100.0f);
                foreach (var it in mVibFishData.FishCompose.FishComposes)
                {
                    if (null != it && it.Id > 0)
                    {
                        TbDataFish      fish_data   = EbDataMgr.Instance.getData <TbDataFish>(it.FishVibId);
                        FishStillSprite fish_sprite = mScene.getRenderObjectPool().newFishStillSprite();

                        fish_sprite.init(this, scene);
                        fish_sprite.playAnimation(fish_data.FishAnimMove);
                        fish_sprite.setScale(mFixFishScale * (float)fish_data.FishHeight / (float)fish_data.FishPixelHeight);

                        mFishs.Add(new FishSpriteAndOffset(
                                       fish_sprite,
                                       new EbVector3(it.OffsetX, it.OffsetY, 0),
                                       fish_data.FishAnimDie));
                    }
                }
            }
        }
Example #3
0
        //-------------------------------------------------------------------------
        protected FishStillSprite _loadFishStillSpriteByFishId(TbDataFish.FishIdAndScaleStruct fish_id_scale)
        {
            TbDataFish      fish_data   = EbDataMgr.Instance.getData <TbDataFish>(fish_id_scale.FishId);
            FishStillSprite fish_sprite = _loadFishStillSprite(fish_data.FishAnimMove);

            fish_sprite.setScale(((float)fish_id_scale.Scale / 100f) * mFixFishScale * (float)fish_data.FishHeight / (float)fish_data.FishPixelHeight);
            return(fish_sprite);
        }
Example #4
0
        //-------------------------------------------------------------------------
        protected FishStillSprite _loadFishStillSprite(string animation_name, float scale = 1f)
        {
            FishStillSprite fish_sprite = mScene.getRenderObjectPool().newFishStillSprite();

            fish_sprite.init(this, mScene);
            fish_sprite.setScale(scale);
            fish_sprite.playAnimation(animation_name);
            return(fish_sprite);
        }
Example #5
0
        //-------------------------------------------------------------------------
        public void setScale(float scale)
        {
            foreach (var it in mFishs)
            {
                it.mFishStillSprite.setScale(mFixFishScale * scale);
            }

            mCycle.setScale(mFixFishScale * scale);

            mScale = mFixFishScale * scale;

            _updateView();
        }