예제 #1
0
        //---------------------------------------------------------------------
        public void create(int turret_id, uint et_player_rpcid, string nickname,
                           bool is_bot, int default_turret_rate, TbDataTurret.TurretType turret_type)
        {
            mTurretId               = turret_id;
            mLockedFish             = null;
            mPlayer.et_player_rpcid = et_player_rpcid;
            mPlayer.nickname        = nickname;
            mPlayer.is_bot          = is_bot;
            mPlayer.rate            = 1.0f;
            mTurretType             = turret_type;
            mTurretDataTable        = new TurretDataTable();

            mBotRandom = new System.Random(unchecked ((int)System.DateTime.Now.Ticks) + turret_id * 1000);

            // 更新炮台倍率
            _setTurretRate(default_turret_rate);

            // 初始化炮台位置
            CTurretHelper turret_helper = new CTurretHelper();

            mTurretPos = turret_helper.getPositionByOffset(turret_id,
                                                           new EbVector3(0, 68, 0));
            mTurretAngle = turret_helper.getBaseAngleByTurretId(turret_id);

            if (isBot())
            {
                mLogicBot = new CLogicBot();
                mLogicBot.create(mScene, this, turret_type);
            }
        }
예제 #2
0
        //-------------------------------------------------------------------------
        public void create(int turret_id, ref _tScenePlayer scene_player, int player_gold,
                           bool buffer_power, bool buffer_freeze, bool buffer_longpress, bool buffer_rapid, int turret_rate, float turret_angle, int locked_fish_objid
                           , TbDataTurret.TurretType turret_type)
        {
            mTurretId    = turret_id;
            mPlayer      = scene_player;
            mTurretAngle = turret_angle;

            mTurretType      = turret_type;
            mTurretDataTable = new TurretDataTable();

            _setTurretRate(turret_rate);

            CTurretHelper turret_helper = mScene.getTurretHelper();

            mTurretPos = turret_helper.getPositionByOffset(turret_id,
                                                           mScene.getRenderConfigure().TurretOffset);
            mBaseAngle   = turret_helper.getBaseAngleByTurretId(turret_id);
            mTurretColor = turret_helper.getBaseColorByTurretId(turret_id).convert();

            float scene_length = mScene.getSceneLength();
            float scene_width  = mScene.getSceneWidth();

            mCSpriteTurretShow = new CSpriteTurretShow();
            mCSpriteTurretShow.create(mScene, this);

            _displayTurretRate();

            mRenderBufferMgr = new CRenderBufferMgr(mScene, this,
                                                    turret_helper.getPositionByOffset(turret_id, mScene.getRenderConfigure().TurretBufferOffset), mBaseAngle);
            setLockFishByFishObjId(locked_fish_objid);

            if (buffer_power)
            {
                List <object> param_list = new List <object>();
                mRenderBufferMgr.addBuffer("BufPower", param_list);
            }

            if (buffer_freeze)
            {
                List <object> param_list = new List <object>();
                mRenderBufferMgr.addBuffer("BufFreeze", param_list);
            }

            if (buffer_longpress)
            {
                List <object> param_list = new List <object>();
                mRenderBufferMgr.addBuffer("BufLongpress", param_list);
            }

            if (buffer_rapid)
            {
                List <object> param_list = new List <object>();
                mRenderBufferMgr.addBuffer("BufRapid", param_list);
            }

            mScene.getListener().onSceneTurretCreated(mTurretId);
        }
예제 #3
0
        //-------------------------------------------------------------------------
        public void create(uint my_et_player_rpcid, bool single, bool is_bot, IRenderListener listener,
                           string configure_filepath, List <JsonPacket> json_packet_list, List <RouteJsonPacket> route_json_packet_list)
        {
            mMyPlayerId    = my_et_player_rpcid;
            mbSingle       = single;
            mListener      = listener;
            mbInit         = false;
            mIsBot         = is_bot;
            mConfigurePath = configure_filepath;

            InputController.Instance.onFingerTouch       += _onFingerTouch;
            InputController.Instance.onFingerLongPress   += _onFingerLongPress;
            InputController.Instance.onFingerUp          += _onFingerUp;
            InputController.Instance.onFingerDragMove    += _onFingerDragMove;
            InputController.Instance.onFingerTouchTurret += _onFingerTouchTurret;
            InputController.Instance.onFingerTouchBuffer += _onFingerTouchBuffer;
            InputController.Instance.onFingerTouchFish   += _onFingerTouchFish;

            InputController.Instance.ActiveInput = true;

            CCoordinate.setCoordinate(new EbVector3(Screen.width, Screen.height, 0),
                                      EbVector3.Zero, new EbVector3(Screen.width, Screen.height, 0));
            mSceneBox     = new CSceneBox();
            mProtocol     = new CRenderProtocol(this);
            mTurretHelper = new CTurretHelper();
            mLayerAlloter = new RenderLayerAlloter();

            mEffectMgr = new CEffectMgr();
            if (!isBot())
            {
                mEffectMgr.regEffectFactory(new EffectShockScreenFactory());
                mEffectMgr.regEffectFactory(new EffectFrameAnimationFactory());
                mEffectMgr.regEffectFactory(new EffectPlayAudioFactory());
                mEffectMgr.regEffectFactory(new EffectLightingFactory());
                mEffectMgr.regEffectFactory(new EffectLockScreenFactory());
                mEffectMgr.regEffectFactory(new EffectFullScreenFactory());
                mEffectMgr.regEffectFactory(new EffectAOEFactory());
            }
            else
            {
                //mEffectMgr.regEffectFactory(new EffectShockScreenFactory());
                mEffectMgr.regEffectFactory(new EffectFrameAnimationFactory());
                //mEffectMgr.regEffectFactory(new EffectPlayAudioFactory());
                mEffectMgr.regEffectFactory(new EffectLightingFactory());
                mEffectMgr.regEffectFactory(new EffectLockScreenFactory());
                mEffectMgr.regEffectFactory(new EffectFullScreenFactory());
                mEffectMgr.regEffectFactory(new EffectAOEFactory());
            }

            mSpriteFishFactory   = new SpriteFishFactory(this);
            mJsonPacketList      = json_packet_list;
            mRouteJsonPacketList = route_json_packet_list;

            mRenderConfigure = new RenderConfigure(mConfigurePath);

            mSoundMgr         = MbMain.Instance.getSoundMgr();
            mRenderObjectPool = new CRenderObjectPool(this);
            mParticlemanager  = new ParticleManager(this);
            mLoadableManager  = new LoadableManager();
            mLoadableManager.create(mRenderObjectPool);
        }