Ejemplo n.º 1
0
        void updateView(CRenderFish fish)
        {
            EbVector3 turret_position = mCRenderTurret.getTurretPos();
            EbVector3 fish_position   = fish.Position;

            float turret_fish_distance = turret_position.getDistance(fish_position);

            int rectangle_count = (int)(turret_fish_distance / mRectangleGap);

            if (rectangle_count < 0)
            {
                rectangle_count = 0;
            }
            if (mRectangle.Count > rectangle_count)
            {
                int remove_count = mRectangle.Count - rectangle_count;

                do
                {
                    mScene.getRenderObjectPool().freeStillSprite(mRectangle[0]);
                    mRectangle.RemoveAt(0);
                    --remove_count;
                } while (remove_count > 0);
            }
            else if (mRectangle.Count < rectangle_count)
            {
                int add_count = rectangle_count - mRectangle.Count;
                do
                {
                    newRectangleSprite();
                    --add_count;
                } while (add_count > 0);
            }


            float angle = CLogicUtility.getAngle(fish_position - turret_position);

            float node_count = mRectangle.Count + 2;

            for (int i = 0; i < mRectangle.Count; i++)
            {
                mRectangle[i].setPosition(EbVector3.lerp(turret_position, fish_position, ((float)i + 1) / node_count));
                mRectangle[i].setDirection(angle);
            }

            mArrow.setPosition(EbVector3.lerp(turret_position, fish_position, (node_count - 1) / node_count));
            mArrow.setDirection(angle);

            mNumber.setPosition(fish_position);
        }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------
        void _die(uint et_player_rpcid, int total_score)
        {
            if (mIsDie)
            {
                return;
            }

            mPlayerId   = et_player_rpcid;
            mTotalScore = total_score;

            mSpriteFreeFromTimeFactor = true;

            // 播放鱼死亡时候的粒子特效
            mFishParticleMgr.fishDie();

            // 显示掉落金币数字
            if (total_score > 0)
            {
                CSpriteFishDieScore score = CSpriteFishDieScore.getScore(mScene, mMassEntity.Position, total_score, 2);//待整理
            }

            // 播放鱼死亡时触发的特效
            foreach (var it in mVibFish.Effects)
            {
                int vib_compose_id = it.Id;

                if (vib_compose_id <= 0)
                {
                    continue;
                }

                Dictionary <string, object> param = new Dictionary <string, object>();
                param.Add("SourcePosition", mMassEntity.Position);
                param.Add("SourceAngle", 0f);
                param.Add("PlayerId", et_player_rpcid);
                CRenderTurret turret = mScene.getTurret(et_player_rpcid);
                if (turret != null)
                {
                    param.Add("DestPosition", turret.getTurretPos());
                }
                else
                {
                    param.Add("DestPosition", mMassEntity.Position);
                }
                param.Add("IsFishDie", true);
                mScene.addEffect(vib_compose_id, param, EffectTypeEnum.Client);
            }

            // 处理SpriteFish
            mFishStopMove = true;

            if (mISpriteFish != null)
            {
                mISpriteFish.playDieAnimation();
            }

            if (mVibFish.Red == TbDataFish.IsRed.YES)
            {
                mScene.getLevel().addRedFishPosition(mFishObjId, Position);
            }

            signDie();
        }