예제 #1
0
    //-------------------------------------------------------------------------
    void OnTriggerEnter(Collider other)
    {
        if (mIsSignDestroy)
        {
            return;
        }

        if ("CSpriteFish" != other.gameObject.tag)
        {
            return;
        }

        if (mBullet.getLockFish() == null)
        {
            FishStillSprite sprite_fish = other.gameObject.GetComponent <FishStillSprite>();
            if (sprite_fish != null)
            {
                _hitFish(sprite_fish.getSpriteFish().getRenderFish());
            }
        }
        else
        {
            FishStillSprite sprite_fish = other.gameObject.GetComponent <FishStillSprite>();
            if (sprite_fish != null && sprite_fish.getSpriteFish().getRenderFish().FishObjId == mBullet.getLockFish().FishObjId)
            {
                _hitFish(sprite_fish.getSpriteFish().getRenderFish());
            }
        }
    }
예제 #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));
                    }
                }
            }
        }
예제 #3
0
 public SpriteAndOffset(FishStillSprite fish, EbVector3 offset, float angle_speed, float layer_offset, string die_animation_name = "")
 {
     mFishStillSprite  = fish;
     mOffset           = offset;
     mAngleSpeed       = angle_speed;
     mLayerOffset      = layer_offset;
     mDieAnimationName = die_animation_name;
 }
예제 #4
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);
        }
예제 #5
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);
        }
예제 #6
0
 //-------------------------------------------------------------------------
 public bool hasFishStillSprite(FishStillSprite fish_still_sprite)
 {
     foreach (var it in mSprite)
     {
         if (it.mFishStillSprite == fish_still_sprite)
         {
             return(true);
         }
     }
     return(false);
 }
예제 #7
0
        //-------------------------------------------------------------------------
        public void freeFishStillSprite(FishStillSprite still_sprite)
        {
#if UNITY_EDITOR
            if (still_sprite != null && still_sprite.GetType().ToString() == "StillSprite")
            {
                EbLog.Error("freeFishStillSprite::error");
            }
#endif
            still_sprite.setISpriteFishNull();
            still_sprite.detachChildren();
            mFishSpritePool.freeStillSprite(still_sprite);
        }
예제 #8
0
 //-------------------------------------------------------------------------
 public bool hasFishStillSprite(FishStillSprite fish_still_sprite)
 {
     if (fish_still_sprite == null)
     {
         return(false);
     }
     foreach (var it in mFishs)
     {
         if (it.mFishStillSprite == fish_still_sprite)
         {
             return(true);
         }
     }
     return(mCycle == fish_still_sprite);
 }
예제 #9
0
    //-------------------------------------------------------------------------
    FishStillSprite getFishOnOnePoint(Vector2 position)
    {
        GameObject picked_obj = pickObjectByUICamera(position);

        if (picked_obj != null && picked_obj.layer == LayerMask.NameToLayer("UI"))
        {
            return(null);
        }

        picked_obj = pickObjectByGameCamera(position);
        if (picked_obj != null && picked_obj.tag == "CSpriteFish")
        {
            FishStillSprite fish = picked_obj.GetComponent <FishStillSprite>();
            return(fish);
        }
        return(null);
    }
예제 #10
0
        public void load(float elapsed_tm)
        {
            if (mLoaded)
            {
                return;
            }

            for (int i = 0; i < 3 * mLoadCountPerSecond; i++)
            {
                StillSprite still_sprite = newStillSprite();
                mListPreloadStillSprite.Add(still_sprite);

#if UNITY_EDITOR
                still_sprite.gameObject.name = "TkSprite_Loading";
#endif
            }

            for (int i = 0; i < 1 * mLoadCountPerSecond; i++)
            {
                FishStillSprite fish_still_sprite = newFishStillSprite();
                mListPreloadFishStillSprite.Add(fish_still_sprite);

#if UNITY_EDITOR
                fish_still_sprite.gameObject.name = "TkFish_Loading";
#endif
            }

            mProgress = (float)mListPreloadFishStillSprite.Count / (float)mPreLoadCount;
            if (mListPreloadFishStillSprite.Count >= mPreLoadCount)
            {
                foreach (var it in mListPreloadStillSprite)
                {
                    freeStillSprite(it);
                }
                mListPreloadStillSprite.Clear();

                foreach (var it in mListPreloadFishStillSprite)
                {
                    freeFishStillSprite(it);
                }
                mListPreloadFishStillSprite.Clear();

                mProgress = 1;
                mLoaded   = true;
            }
        }
예제 #11
0
        //-------------------------------------------------------------------------
        public override void onTouch(GameObject buffer)
        {
            if (!_isMe())
            {
                return;
            }

            base.onTouch(buffer);

            FishStillSprite fish_still_sprite = buffer.GetComponent <FishStillSprite>();

            if ((mSprite != null && mSprite.gameObject == buffer) ||
                (mSpriteFish != null && mSpriteFish.hasFishStillSprite(fish_still_sprite)))
            {
                mLockFishObjId = -1;
                signDestroy();
            }
        }
예제 #12
0
    //-------------------------------------------------------------------------
    void OnTriggerEnter(Collider other)
    {
        if (mMaxHitFish <= 0)
        {
            mCSpriteFishNetGroup.setTrigger(false);
            return;
        }
        if ("CSpriteFish" != other.gameObject.tag)
        {
            return;
        }

        FishStillSprite sprite_fish = other.gameObject.GetComponent <FishStillSprite>();
        CRenderFish     render_fish = sprite_fish.getSpriteFish().getRenderFish();

        if (render_fish != null)
        {
            _hitFish(render_fish);
        }
    }
예제 #13
0
        //---------------------------------------------------------------------
        public bool hasFishStillSprite(FishStillSprite fish_still_sprite)
        {
            if (fish_still_sprite == null)
            {
                return(false);
            }
            foreach (var it in mFishs)
            {
                if (it == fish_still_sprite)
                {
                    return(true);
                }
            }

            if (mRedBottom != null)
            {
                mRedBottom.hasFishStillSprite(fish_still_sprite);
            }

            return(false);
        }
예제 #14
0
 public FishSpriteAndOffset(FishStillSprite fish, EbVector3 offset, string die_animation_name)
 {
     mFishStillSprite  = fish;
     mOffset           = offset;
     mDieAnimationName = die_animation_name;
 }