Esempio n. 1
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);
        }
Esempio n. 2
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);
            }
        }