示例#1
0
        public void add(EbVector3 origin, EbVector3 gap, CRenderScene scene, CSpriteCounter._tScoreCountScruct score_count, float up_angle)
        {
            int index_null = mCSpriteHeaps.Length;

            for (int i = mCSpriteHeaps.Length - 1; i >= 0; --i)
            {
                if (mCSpriteHeaps[i] == null)
                {
                    index_null = i;
                }
                else
                {
                    break;
                }
            }

            if (index_null >= mCSpriteHeaps.Length)
            {
                return;
            }

            EbVector3 position = origin;

            position -= gap * index_null;

            mCSpriteHeaps[index_null] = new CSpriteHeap(scene, score_count.Number, score_count.Score, position, up_angle, getColor());
        }
示例#2
0
 //-------------------------------------------------------------------------
 public CRenderBufferMgr(CRenderScene scene, CRenderTurret turret, EbVector3 position, float up_angle)
 {
     mScene = scene;
     mTurret = turret;
     mFisrtPoint = position;
     mUpAngle = up_angle;
 }
        //-------------------------------------------------------------------------
        public override void create(Dictionary<string, object> param)
        {
            mMapParam = param;
            mScene = mMapParam["LogicScene"] as CLogicScene;
            mPos = (EbVector3)mMapParam["SourcePosition"];

            uint et_player_rpcid = (uint)mMapParam["PlayerID"];
            int bullet_rate = (int)mMapParam["BulletRate"];
            int die_fish_id = (int)mMapParam["DieFishObjId"];

            int score = 0;

            TbDataEffectRadiationLighting effect_data = EbDataMgr.Instance.getData<TbDataEffectRadiationLighting>(mEffectId);
            List<CLogicFish> fish_list = mScene.getLevel().getListFishById(effect_data.NormalFish.Id);
            int each_fish_score = EbDataMgr.Instance.getData<TbDataFish>(effect_data.NormalFish.Id).FishScore;
            foreach (var n in fish_list)
            {
                score += each_fish_score;
                n.signDestroy();
            }

            // 服务端广播创建特效
            List<string> custom_param_list = new List<string>();
            custom_param_list.Add(effect_data.NormalFish.Id.ToString());

            mScene.getProtocol().s2allcCreateClientEffect(
                et_player_rpcid, bullet_rate, mPos, die_fish_id,
                mEffectId, mEffectName, (int)mEffectType, mDelayTime,
                custom_param_list);

            mReturnValue = new List<object>();
            ReturnValue.Add("Lighting");
            ReturnValue.Add(score);
            ReturnValue.Add(effect_data.NormalFish.Id);
        }
示例#4
0
        public void setDynamicSystem(DynamicSystem system)
        {
            mDynamicSystem = system;

            mViSpeed = mDynamicSystem.mSpeed;
            mPosition = mDynamicSystem.mPosition;
        }
示例#5
0
        EbVector3[] mBasePositions = new EbVector3[7]; // 0-5是联机玩家的炮台,6号炮台为单机炮台

        #endregion Fields

        #region Constructors

        //-------------------------------------------------------------------------
        public CTurretHelper()
        {
            float scene_length = CCoordinate.LogicSceneLength;
            float scene_width = CCoordinate.LogicSceneWidth;

            mBasePositions[0] = new EbVector3(-(scene_length / 4), scene_width / 2, 0);
            mBasePositions[1] = new EbVector3(scene_length / 4, scene_width / 2, 0);
            mBasePositions[2] = new EbVector3(scene_length / 2, 0, 0);

            mBasePositions[3] = new EbVector3(scene_length / 4, -(scene_width / 2), 0);
            mBasePositions[4] = new EbVector3(-(scene_length / 4), -(scene_width / 2), 0);
            mBasePositions[5] = new EbVector3(-(scene_length / 2), 0, 0);
            mBasePositions[6] = new EbVector3(0, -(scene_width / 2), 0);

            mBaseAngles[0] = 180f;
            mBaseAngles[1] = 180f;
            mBaseAngles[2] = -90f;
            mBaseAngles[3] = 0f;
            mBaseAngles[4] = 0f;
            mBaseAngles[5] = 90f;
            mBaseAngles[6] = 0f;

            mBaseColor[0] = new Color(240 / 255f, 255f / 255f, 240f / 255f);
            mBaseColor[1] = new Color(255f / 255f, 255f / 255f, 255 / 255f);
            mBaseColor[2] = new Color(240f / 255f, 255f / 255f, 255 / 255f);

            mBaseColor[3] = new Color(255 / 255f, 240 / 255f, 245f / 255f);
            mBaseColor[4] = new Color(255 / 255f, 240 / 255f, 180 / 245f);
            mBaseColor[5] = new Color(255 / 255f, 255 / 255f, 224 / 255f);

            mBaseColor[6] = new Color(255 / 255f, 240 / 255f, 245f / 255f);
        }
示例#6
0
文件: EbGrid.cs 项目: yinlei/GF.Core
        //---------------------------------------------------------------------
        public List<EbVector3> navigate(EbVector3 from_world, EbVector3 to_world, uint max_step)
        {
            EbVector2 from_grid = _world2gird(from_world);
            EbVector2 to_grid = _world2gird(to_world);

            List<EbVector3> route_points = new List<EbVector3>();
            if (_isInGrid(from_grid) && _isInGrid(to_grid))
            {
                if (mPixelNav.search((int)from_grid.x, (int)from_grid.y, (int)to_grid.x, (int)to_grid.y, max_step))
                {
                    for (int i = 1; i < mPixelNav.Route.Count - 1; ++i)
                    {
                        route_points.Add(_grid2world(mPixelNav.Route[i]));
                    }
                    route_points.Add(to_world);
                }
                else
                {
                    for (int i = 1; i < mPixelNav.Route.Count; ++i)
                    {
                        route_points.Add(_grid2world(mPixelNav.Route[i]));
                    }
                }
            }

            return route_points;
        }
示例#7
0
 //-------------------------------------------------------------------------
 public CSpriteScoreTurnplate(CRenderScene scene, EbVector3 position, float up_angle)
 {
     mScene = scene;
     mPosition = position;
     mAngle = up_angle;
     mSpriteNumber = new CSpriteNumber(mScene, new CScoreDigitFactory(mScene));
     mSpriteNumber.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.TurretScore));
 }
示例#8
0
 //-------------------------------------------------------------------------
 public void translate(EbVector3 position)
 {
     foreach (var it in mCSpriteHeaps)
     {
         if (it == null) continue;
         it.translate(position);
     }
 }
示例#9
0
        //---------------------------------------------------------------------
        public bool check(ref EbVector3 position, ref float direction)
        {
            EbVector3 dir_vector = CLogicUtility.getDirection(direction);

            if (position.x < -CCoordinate.LogicSceneLength / 2)
            {
                if (dir_vector.x == 0) return false;
                EbVector3 return_postion = new EbVector3();
                return_postion.x = -CCoordinate.LogicSceneLength / 2;
                return_postion.y = straightLineEquationByX(position, dir_vector, return_postion.x);
                return_postion.z = position.z;
                position = return_postion;
                dir_vector.x = -dir_vector.x;
                direction = CLogicUtility.getAngle(dir_vector);
                return true;
            }

            if (position.x > CCoordinate.LogicSceneLength / 2)
            {
                if (dir_vector.x == 0) return false;
                EbVector3 return_postion = new EbVector3();
                return_postion.x = CCoordinate.LogicSceneLength / 2;
                return_postion.y = straightLineEquationByX(position, dir_vector, return_postion.x);
                return_postion.z = position.z;
                position = return_postion;
                dir_vector.x = -dir_vector.x;
                direction = CLogicUtility.getAngle(dir_vector);
                return true;
            }

            if (position.y < -CCoordinate.LogicSceneWidth / 2)
            {
                if (dir_vector.y == 0) return false;
                EbVector3 return_postion = new EbVector3();
                return_postion.y = -CCoordinate.LogicSceneWidth / 2;
                return_postion.x = straightLineEquationByY(position, dir_vector, return_postion.y);
                return_postion.z = position.z;
                position = return_postion;
                dir_vector.y = -dir_vector.y;
                direction = CLogicUtility.getAngle(dir_vector);
                return true;
            }

            if (position.y > CCoordinate.LogicSceneWidth / 2)
            {
                if (dir_vector.y == 0) return false;
                EbVector3 return_postion = new EbVector3();
                return_postion.y = CCoordinate.LogicSceneWidth / 2;
                return_postion.x = straightLineEquationByY(position, dir_vector, return_postion.y);
                return_postion.z = position.z;
                position = return_postion;
                dir_vector.y = -dir_vector.y;
                direction = CLogicUtility.getAngle(dir_vector);
                return true;
            }

            return false;
        }
示例#10
0
 //---------------------------------------------------------------------
 public bool isInBox(EbVector3 point)
 {
     EbVector3 local = trans2local(point);
     return
         local.x >= mQuadrantPoints.TL.x &&
         local.x <= mQuadrantPoints.TR.x &&
         local.y <= mQuadrantPoints.TL.y &&
         local.y >= mQuadrantPoints.BL.y;
 }
示例#11
0
        //---------------------------------------------------------------------
        // 将逻辑坐标系转换为2D toolkit对应的坐标系
        public static EbVector3 logic2toolkitPos(EbVector3 logic_pos)
        {
            EbVector3 toolkit_pos = EbVector3.Zero;

            toolkit_pos.x = (logic_pos.x + LogicSceneLength / 2);
            toolkit_pos.y = (logic_pos.y + LogicSceneWidth / 2);

            return toolkit_pos;
        }
示例#12
0
        //-------------------------------------------------------------------------
        public void create(uint et_player_rpcid, int bullet_objid, int bullet_vibid, float bullet_speed,
            int locked_fish_obj_id, EbVector3 turret_pos, float turret_angle, TbDataParticle hit_particle)
        {
            // vib
            mPlayerId = et_player_rpcid;
            mVibBullet = EbDataMgr.Instance.getData<TbDataBullet>(bullet_vibid);
            mPos = turret_pos;
            mfAngle = turret_angle;
            mBulletObjId = bullet_objid;
            mLockedFishObjid = locked_fish_obj_id;
            //mfBulletSpeed = mVibBullet.Speed;
            mfBulletSpeed = bullet_speed;

            // sprite bullet
            CRenderTurret turret = mScene.getTurret(mPlayerId);
            int turret_id = turret.getTurretId();
            string bullet_anim = mVibBullet.Bullet0Animation;
            if (turret.isPower())
            {
                bullet_anim = mVibBullet.ColorBulletAnimation;
            }
            else
            {
                switch (turret_id)
                {
                    case 1:
                        bullet_anim = mVibBullet.Bullet1Animation;
                        break;
                    case 2:
                        bullet_anim = mVibBullet.Bullet2Animation;
                        break;
                    case 3:
                        bullet_anim = mVibBullet.Bullet3Animation;
                        break;
                    case 4:
                        bullet_anim = mVibBullet.Bullet4Animation;
                        break;
                    case 5:
                        bullet_anim = mVibBullet.Bullet5Animation;
                        break;
                    case 6:
                        bullet_anim = mVibBullet.Bullet6Animation;
                        break;
                }
            }
            mBulletAnim = bullet_anim;
            mSpriteBullet = new CSpriteBullet();
            mSpriteBullet.create(mScene, this, mBulletAnim, hit_particle);
            mSpriteBullet.setTrigger(true, 200);

            mSpriteBullet.setPosition(mPos);
            mSpriteBullet.setDirection(mfAngle);
            mSpriteBullet.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.Bullet));
            mSpriteBullet.setScale((float)mVibBullet.BulletHeight / (float)mVibBullet.BulletPixelHeight);
            mScene.getLevel().addBullet(this);
        }
示例#13
0
        //-----------------------------------------------------------------------------
        public void create(EbVector3 init_position, float init_angle, float width, float height)
        {
            mInitPosition = init_position;
            mInitAngle = init_angle;
            mDirection = CLogicUtility.getDirection(mInitAngle);
            mDuration = width;

            mParaParamB = 4 * height / width;
            mParaParamA = -mParaParamB / width;
        }
示例#14
0
文件: Route.cs 项目: yinlei/Fishing
        //-----------------------------------------------------------------------------
        public static IRoute buildLineRoute(EbVector3 start_position, EbVector3 end_position)
        {
            List<EbVector3> points_list = new List<EbVector3>();
            points_list.Add(start_position);
            points_list.Add(end_position);

            RouteLine route = new RouteLine();
            route.create(0, points_list);
            return route;
        }
示例#15
0
        //-------------------------------------------------------------------------
        CSpriteFishDieScore(CRenderScene render_scene, EbVector3 pos, int score, float delay_time)
        {
            mCSpriteNumber = new CSpriteNumber(render_scene, new CScoreDigitFactory(render_scene));
            mCSpriteNumber.create(score, pos, 0, getByScore(score));
            mCSpriteNumber.setLayer(render_scene.getLayerAlloter().getLayer(_eLevelLayer.FishScore));
            mFunDelayTime = delay_time;
            mIsNeedAutoDestroy = true;

            _initRoute(pos, 0);
            mNumber = score;
        }
示例#16
0
        //-------------------------------------------------------------------------
        public void create(int number, EbVector3 postion, float up_angle, _eNumberSize size, _eNumberAlign align = _eNumberAlign.Center)
        {
            mNumberInfo.Position = postion;
            mNumberInfo.UpAngle = up_angle;
            mNumberInfo.DigitGap = _calculateDigitGap(size);
            mNumberInfo.Align = align;
            mNumberInfo.DigitScale = mFactory.getScale(size);
            mNumberInfo.DigitCount = _calculateDigitCount(number);
            mNumberInfo.Tag = "Untagged";

            setNumber(number);
        }
示例#17
0
        //---------------------------------------------------------------------
        public static EbVector3 pixel2logicPos(EbVector3 pixel_pos)
        {
            //逻辑位置在正中心为(0,0),以米为单位
            //屏幕坐标原点为屏幕的左下角,屏幕的宽度对应逻辑长度960米
            EbVector3 logic_postion = pixel_pos;

            logic_postion.x *= mLogic2PixelX;
            logic_postion.y *= mLogic2PixelY;

            logic_postion.x -= LogicSceneLength / 2f;
            logic_postion.y -= LogicSceneWidth / 2f;

            return logic_postion;
        }
示例#18
0
        //-------------------------------------------------------------------------
        public CSpriteHeap(CRenderScene scene, int number_of_chip, int score, EbVector3 position, float up_angle, CSpriteBgNumber.BgColorEnum color)
        {
            mScene = scene;

            mHeapScruct.NumberOfChip = number_of_chip;
            mHeapScruct.Position = position;
            mHeapScruct.UpAngle = up_angle;
            mHeapScruct.Alpha = 1f;
            mCSpriteBgNumber = new CSpriteBgNumber(mScene, color, score);

            mHeapLayer = mScene.getLayerAlloter().getLayer(_eLevelLayer.TurretChips);

            mHeapState = _eHeapState.Adding;
        }
示例#19
0
        //---------------------------------------------------------------------
        public override void start()
        {
            base.start();

            mEffectSpreadFishData = EbDataMgr.Instance.getData<TbDataEffectSpreadFish>(mEffectId);

            mScene = (CLogicScene)mMapParam["LogicScene"];
            mWaveCount = mEffectSpreadFishData.SpreadCount;
            mSourcePosition = (EbVector3)mMapParam["SourcePosition"];
            mEffectGapTime = mEffectSpreadFishData.GapTime * 0.01f; ;
            mTimeCounter = mEffectGapTime;

            mRedObjId = (int)mMapParam["RedFishObjId"];
        }
示例#20
0
        //---------------------------------------------------------------------
        public void add(float time_x, EbVector3 acce, float duration)
        {
            if (duration <= 0) return;

            if (mAcceleration.ContainsKey(time_x))
            {
                EbLog.Note("DynamicSystem::add::error.");
                return;
            }

            Acceleration acceleration = new Acceleration();
            acceleration.acceleration = acce;
            acceleration.duration = duration;
            mAcceleration.Add(time_x, acceleration);
        }
示例#21
0
        //-------------------------------------------------------------------------
        public override void create(Dictionary<string, object> param)
        {
            mMapParam = param;
            mScene = mMapParam["RenderScene"] as CRenderScene;

            if (mMapParam.ContainsKey("SourcePosition"))
            {
                mSourcePosition = (EbVector3)mMapParam["SourcePosition"];
            }

            if (mMapParam.ContainsKey("DestPosition"))
            {
                mDestPosition = (EbVector3)mMapParam["DestPosition"];
            }
        }
示例#22
0
        //-------------------------------------------------------------------------
        public CSpriteCounter(CRenderScene scene, EbVector3 origin_position, float up_angle)
        {
            mScene = scene;

            mCounterScruct.MovingSpeed = 100f;
            mCounterScruct.OriginPosition = origin_position;
            mCounterScruct.UpAngle = up_angle;
            mCounterScruct.GapBetweenHeaps = mScene.getRenderConfigure().ChipHSpace;
            mCounterScruct.RightAngle = CLogicUtility.getRightAngle(up_angle);
            mCounterScruct.RightDistance = CLogicUtility.getDirection(mCounterScruct.RightAngle) * mCounterScruct.GapBetweenHeaps;
            mCounterState = _eCounterState.Adding;
            mCSpriteHeapGroup = new CSpriteHeapGroup(4);

            mScoreCounterMap.create(mScene.getRenderConfigure().ScoreGap);
        }
示例#23
0
        //-----------------------------------------------------------------------------
        public void create(float delay_time, List<EbVector3> points)
        {
            for (int i = 0; i < points.Count; i++)
            {
                mPoints.Add(points[i]);
                if (i >= points.Count - 1) continue;
                mGapList.Add(points[i].getDistance(points[i + 1]));
            }

            mDirection = (mPoints[mAtWhichPoint + 1] - mPoints[mAtWhichPoint]).normalized;

            next(0, 100);

            mDelayTime = delay_time;
        }
示例#24
0
        //-----------------------------------------------------------------------------
        public void next(float elapsed_tm, float speed)
        {
            if (mIsEndRoute) return;

            mTime += elapsed_tm;

            if (mTime >= mDuration)
            {
                mPosition = mInitPosition;
                mIsEndRoute = true;
                return;
            }

            float delta_y = _getCurveValue(mTime);
            mPosition = mInitPosition + CLogicUtility.getVector2ByRotateAngle(new EbVector3(0, delta_y, 0), mInitAngle);
        }
示例#25
0
        //-------------------------------------------------------------------------
        public override void create(Dictionary<string, object> param)
        {
            mMapParam = param;
            mScene = mMapParam["LogicScene"] as CLogicScene;
            mPos = (EbVector3)mMapParam["SourcePosition"];

            uint et_player_rpcid = (uint)mMapParam["PlayerID"];
            int bullet_rate = (int)mMapParam["BulletRate"];
            TbDataEffectAOE effect_data = EbDataMgr.Instance.getData<TbDataEffectAOE>(mEffectId);

            int total_score = 0;
            int fish_score = 0;
            int effect_fish_vib_id = -1;
            bool fish_die = false;

            List<CLogicFish> fish_list = getFishByPositionAndRadius(mPos, (float)effect_data.Radius);
            List<string> custom_param_list = new List<string>();

            // 遍历aoe范围内的活鱼
            foreach (var fish in fish_list)
            {
                // 检查是否在鱼的销毁列表,如果在则跳过,防止重复计算。
                if (fish.IsDie) continue;
                // 击中鱼测试,击中则把分数包括特效分数计下来,一起计算到aoe特效分数里面去。
                fish_score = 0;
                effect_fish_vib_id = -1;
                fish_die = fish.hit(et_player_rpcid, bullet_rate, ref fish_score, ref effect_fish_vib_id);

                if (fish_die)
                {
                    custom_param_list.Add(fish.FishObjId.ToString());
                    total_score += fish_score;
                }
            }

            // 服务端广播创建特效
            int current_die_fish_id = (int)mMapParam["DieFishObjId"];//触发这个效果的鱼

            mScene.getProtocol().s2allcCreateClientEffect(
                et_player_rpcid, bullet_rate, mPos, current_die_fish_id,
                mEffectId, mEffectName, (int)mEffectType, mDelayTime,
                custom_param_list);

            mReturnValue = new List<object>();
            ReturnValue.Add("EffectAOE");
            ReturnValue.Add(total_score);
        }
示例#26
0
        //-------------------------------------------------------------------------
        public void create(int number, float number_picture_length, EbVector3 postion, float up_angle, _eNumberAlign align = _eNumberAlign.Center)
        {
            mNumberInfo.DigitCount = _calculateDigitCount(number);

            float digit_width = number_picture_length / mNumberInfo.DigitCount;
            float picture_width = mFactory.getScale(_eNumberSize.BaseGap) / mFactory.getScale(_eNumberSize.Nomal);
            float scale = digit_width / picture_width;

            mNumberInfo.Position = postion;
            mNumberInfo.UpAngle = up_angle;
            mNumberInfo.DigitGap = _calculateDigitGap(scale);
            mNumberInfo.Align = align;
            mNumberInfo.DigitScale = scale;
            mNumberInfo.Tag = "Untagged";

            setNumber(number);
        }
示例#27
0
        //-------------------------------------------------------------------------
        public CSpriteScore(CRenderScene scene, EbVector3 position, float angle, int turret_no)
        {
            mScene = scene;

            mSpriteNumber = new CSpriteNumber(mScene, new CPanelDigitFactory(mScene));
            mSpriteNumber.create(0, position, angle, CSpriteNumber._eNumberSize.Small1, CSpriteNumber._eNumberAlign.Right);
            mSpriteNumber.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.TurretScore));
            mBackground = mScene.getRenderObjectPool().newStillSprite();
            mBackground.playAnimation("score_panel_" + turret_no);
            mBackground.setScale(1, 1f);

            setScore(0);

            #if UNITY_EDITOR
            mBackground.gameObject.name = "TkSpriteSpriteScore_score_panel_" + turret_no;
            #endif
        }
示例#28
0
        //---------------------------------------------------------------------
        public void create(uint et_player_rpcid, int bullet_objid, int turret_rate, int bullet_vibid,
            EbVector3 turret_pos, float turret_angle, float bullet_speed)
        {
            mPlayerId = et_player_rpcid;
            mBulletObjId = bullet_objid;
            mPos = turret_pos;
            mfAngle = turret_angle;
            miTurretRate = turret_rate;
            mfBulletSpeed = bullet_speed;

            CLogicTurret turret = mScene.getTurret(mPlayerId);
            if (turret == null || !turret.isBot()) return;

            mBulletCollider = mScene.getColliderMgr().newBulletCollider(0, 0, 41, 47);// 读取vib配置
            mBulletCollider.onCollision += onCollision;
            mBulletCollider.setDirection(mfAngle);
            update(0);
        }
示例#29
0
        //-------------------------------------------------------------------------
        void create(EbVector3 cur_pos)
        {
            string animation_name = "";

            float scale_x = 1f;
            float scale_y = 1f;
            float width_x = 10f;
            float width_y = 60f;

            if (mScene.getLevel().getRandoNumber(0, 100) < 50)
            {
                animation_name = "lightening-yellow";
                scale_y = width_y / 132f;
                width_x = 360f;
            }
            else
            {
                animation_name = "lightning-green";
                scale_y = width_y / 85f;
                width_x = 420f;
            }
            foreach (var n in fish_list)
            {
                float distance = n.Position.getDistance(cur_pos);
                if (distance > 1100)
                    continue;
                EbVector3 middle_pos = EbVector3.lerp(n.Position, cur_pos, 0.5f);
                StillSprite still_sprite = mScene.getRenderObjectPool().newStillSprite();
                still_sprite.setPosition(middle_pos);
                still_sprite.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.FishSwim));

                still_sprite.setDirection(CLogicUtility.getAngle(CLogicUtility.getVector2ByRotateAngle(cur_pos - n.Position, 90)));
                still_sprite.setScale(n.Position.getDistance(cur_pos) / width_x, scale_y);

                still_sprite.playAnimation(animation_name);

                mListLight.Add(still_sprite);

            #if UNITY_EDITOR
                still_sprite.gameObject.name = "TkSpriteEffectLighting_" + animation_name;
            #endif
            }
        }
示例#30
0
        //-------------------------------------------------------------------------
        public override void create(Dictionary<string, object> param)
        {
            base.create(param);
            mSourcePosition = (EbVector3)mMapParam["SourcePosition"];
            TbDataEffectRadiationLighting effect_data = EbDataMgr.Instance.getData<TbDataEffectRadiationLighting>(mEffectId);
            fish_list = mScene.getLevel().getListFishById(effect_data.NormalFish.Id);
            int current_rate = (int)mMapParam["Rate"];
            uint et_player_rpcid = (uint)mMapParam["PlayerId"];

            // 销毁一起被连死的鱼
            List<string> custom_param_list = (List<string>)mMapParam["EffectCustomParam"];
            int effect_fish_vibid = int.Parse(custom_param_list[0]);
            if (effect_fish_vibid != -1)
            {
                List<CRenderFish> fishs = mScene.getLevel().getListFishById(effect_fish_vibid);
                foreach (var f in fishs)
                {
                    f.dieWithRate(et_player_rpcid, current_rate);
                }
            }
        }
示例#31
0
 //-------------------------------------------------------------------------
 public static void DrawLine(EbVector3 start, EbVector3 end, EbColor color)
 {
     OnDrawLine(start, end, color);
 }
示例#32
0
 //---------------------------------------------------------------------
 public static Vector3 toVector3(this EbVector3 vector)
 {
     return(new Vector3(vector.x, vector.y, vector.z));
 }
示例#33
0
        //---------------------------------------------------------------------
        float randomTurretAngle()
        {
            EbVector3 bullet_direction = randomTarget() - mTurret.getTurretPos();

            return(CLogicUtility.getAngle(bullet_direction));
        }
示例#34
0
 //-------------------------------------------------------------------------
 public void setPosition(EbVector3 pos, float angle)
 {
     mCSpriteFishNetGroup.setPosition(pos, angle);
 }
示例#35
0
 //-------------------------------------------------------------------------
 public void setPosition(EbVector3 position)
 {
     mStillSprite.setPosition(position);
 }
示例#36
0
        //-------------------------------------------------------------------------
        public void update(float elapsed_tm)
        {
            if (mDynamicSystem != null)
            {
                mTotalElapsedTime += elapsed_tm;
                EbVector3 acc = mDynamicSystem.getAcce(mTotalElapsedTime, mViSpeed);
                if (mDynamicSystem.IsDelay)
                {
                }
                else
                {
                    mViSpeed  = mViSpeed + acc * elapsed_tm;
                    mPosition = mPosition + mViSpeed * elapsed_tm;
                    mAngle    = CLogicUtility.getAngle(mViSpeed);

                    if (mDynamicSystem.IsEnd)
                    {
                        mIsEndRoute = true;
                    }
                }
            }
            else
            if (mIRoute != null)
            {
                mIRoute.next(elapsed_tm, mSpeed);
                mPosition = mIRoute.Position;
                mAngle    = CLogicUtility.getAngle(mIRoute.Direction);

                if (mIRoute.IsEndRoute)
                {
                    mIsEndRoute = true;
                }
            }
            else
            {
                //mAngle += mAngleSpeed * elapsed_tm;

                float newAngle = mAngle + mAngleSpeed * elapsed_tm;

                if (mAngleSpeed > 0)
                {
                    if (mAngle <= 180 && newAngle > 180)
                    {
                        mAngle = newAngle - 360;
                    }
                    else
                    {
                        mAngle = newAngle;
                    }
                }
                else
                {
                    //if (mAngle <= -180) mAngle = mAngle - 180;
                    if (mAngle > -180 && newAngle <= 180)
                    {
                        mAngle = newAngle + 360;
                    }
                    else
                    {
                        mAngle = newAngle;
                    }
                }

                //mAngle = regularAngle(mAngle);

                mPosition += CLogicUtility.getDirection(mAngle) * mSpeed * elapsed_tm;
            }

            _updateState();
        }
示例#37
0
 //---------------------------------------------------------------------
 public CDirection(EbVector3 direction)
 {
     mDirection = direction.normalized;
 }
示例#38
0
        //---------------------------------------------------------------------
        // 服务端广播效果发炮
        public void s2allcEfxFire(uint et_player_rpcid, int bullet_vibid, int buffet_objid,
                                  float level_cur_second, float turret_angle, int turret_rate, EbVector3 pos)
        {
            List <string> vec_param = new List <string>();

            vec_param.Add(((byte)_eProtocolDesktop.s2allcEfxFire).ToString());
            vec_param.Add(et_player_rpcid.ToString());
            vec_param.Add(bullet_vibid.ToString());
            vec_param.Add(buffet_objid.ToString());
            vec_param.Add(level_cur_second.ToString());
            vec_param.Add(turret_angle.ToString());
            vec_param.Add(turret_rate.ToString());
            vec_param.Add(pos.x.ToString());
            vec_param.Add(pos.y.ToString());
            vec_param.Add(pos.z.ToString());

            mQueProtocol.Enqueue(vec_param);
        }
示例#39
0
        //-------------------------------------------------------------------------
        public void s2allcEfxFire(int bullet_vibid, int bullet_objid, float level_cur_second, float turret_angle, int turret_rate, EbVector3 pos)
        {
            //bool is_me = (mScene.getMyPlayerId() == mPlayer.player_entityid);
            //if (!is_me)
            {
                mTurretAngle = turret_angle;
                mTurretRate  = turret_rate;

                mBulletFirePos = pos;
                mCSpriteTurretShow.aimAt(mTurretAngle);
                CRenderBullet bullet = new CRenderBullet(mScene);
                bullet.create(mPlayer.et_player_rpcid, bullet_objid, bullet_vibid, CBulletConstant.ManualSpeed,
                              _getLockedFishIdFromLockedBuffer(), mBulletFirePos, turret_angle, mVibTurret.HitFishParticleDataKey);
            }
        }
示例#40
0
 //-------------------------------------------------------------------------
 public override void create(Dictionary <string, object> param)
 {
     base.create(param);
     mPosition     = (EbVector3)mMapParam["SourcePosition"];
     mDestPosition = (EbVector3)mMapParam["DestPosition"];
 }
示例#41
0
        //---------------------------------------------------------------------
        EbVector3 getSpeed(RouteObject.Velocity velocity)
        {
            EbVector3 speed = CLogicUtility.getDirection(velocity.direction);

            return(speed * velocity.speed);
        }
示例#42
0
 //---------------------------------------------------------------------
 public RectArea(EbVector3 origin, EbVector3 size)
 {
     mOrigin = origin;
     mSize   = size;
 }
示例#43
0
 //-------------------------------------------------------------------------
 protected void _newSpriteAndOffset(string layer0animation, string layer1animation, TbDataFish.FishIdAndScaleStruct fish_id_scale, EbVector3 position, float layer_offset, float angle_speed)
 {
     mBackground.Add(new SpriteAndOffset(_loadFishStillSprite(layer0animation), position, -angle_speed, mFishCycleGap * 2 + layer_offset));
     mBackground.Add(new SpriteAndOffset(_loadFishStillSprite(layer1animation), position, angle_speed, mFishCycleGap + layer_offset));
     mFishs.Add(new SpriteAndOffset(_loadFishStillSpriteByFishId(fish_id_scale), position, 0, 0, EbDataMgr.Instance.getData <TbDataFish>(fish_id_scale.FishId).FishAnimDie));
 }
示例#44
0
 //-------------------------------------------------------------------------
 public static void DrawRay(EbVector3 origin, EbVector3 direct, EbColor color)
 {
     OnDrawLine(origin, origin + direct * 1000f, color);
 }
示例#45
0
 //---------------------------------------------------------------------
 public void outRedFish(int normal_fish_vib_id, int red_fish_vib_id, int fish_count, EbVector3 position, int red_fish_obj_id)
 {
     mLogicParticleSystemOuter.outRedFish(normal_fish_vib_id, red_fish_vib_id, fish_count, position, red_fish_obj_id);
 }
示例#46
0
 //-------------------------------------------------------------------------
 public void setTurretAngle(float turret_angel)
 {
     mTurretAngle   = turret_angel;
     mBulletFirePos = mTurretPos + CLogicUtility.getDirection(mTurretAngle).normalized *mBarrelOffset;
     mCSpriteTurretShow.aimAt(mTurretAngle);
 }
示例#47
0
 //-------------------------------------------------------------------------
 public void setPosition(EbVector3 position)
 {
     mPosition = position;
 }
示例#48
0
 //---------------------------------------------------------------------
 // 获取当前路径点
 // 参数:起点(米),速度(米/秒),时间(秒)
 public static EbVector3 getCurrentPos(EbVector3 start_pos, float angle, float speed, float time_span)
 {
     return(start_pos + getDirection(angle) * speed * time_span);
 }
示例#49
0
 public static float Angle(EbVector3 from, EbVector3 to)
 {
     return(EbMath.Acos(EbMath.Clamp(EbVector3.dot(from.normalized, to.normalized), -1f, 1f)));
 }
示例#50
0
 //---------------------------------------------------------------------
 public static CDirection slerp(CDirection left_direction, CDirection right_direction, float t)
 {
     return(new CDirection(EbVector3.lerp(left_direction.mDirection, right_direction.mDirection, t)));
 }
示例#51
0
 public SpriteAndOffset(StillSprite sprite, EbVector3 offset)
 {
     mStillSprite = sprite;
     mOffset      = offset;
 }
示例#52
0
        //---------------------------------------------------------------------
        public static void setCoordinate(EbVector3 screen_size, EbVector3 area_origin, EbVector3 area_size)
        {
            // 屏幕坐标原点为屏幕的左下角为屏幕原点计算
            mScreenSize     = screen_size;
            mScreenSize.z   = 0;
            mGameAreaOrigin = area_origin;
            mGameAreaSize   = area_size;

            initConversionOfCoordinates();
            //EbLog.Warning("setCoordinate screen_size" + screen_size + "area_origin" + area_origin + "area_size" + area_size + "mLogic2PixelX" + mLogic2PixelX + "mLogic2PixelY" + mLogic2PixelY);
        }
示例#53
0
 //---------------------------------------------------------------------
 public CDirection(float angle)
 {
     mDirection = CLogicUtility.getDirection(angle);
 }
示例#54
0
 //---------------------------------------------------------------------
 static EbVector3 screen2game_area_pos(EbVector3 screen_pos)
 {
     return(screen_pos - mGameAreaOrigin);
 }
示例#55
0
 //-------------------------------------------------------------------------
 float getHitAngle(EbVector3 fish_pos, EbVector3 bullet_pos)
 {
     return(CLogicUtility.getAngle(fish_pos - bullet_pos));
 }
示例#56
0
 //---------------------------------------------------------------------
 static EbVector3 game_area2screen_pos(EbVector3 game_area_pos)
 {
     return(game_area_pos + mGameAreaOrigin);
 }
示例#57
0
        //-------------------------------------------------------------------------
        Vector2 pixel2logicPos(Vector2 origin)
        {
            EbVector3 vv = CCoordinate.pixel2logicPos(new EbVector3(origin.x, origin.y, 0));

            return(new Vector2(vv.x, vv.y));
        }
示例#58
0
 //---------------------------------------------------------------------
 // conversion of coordinates
 public static EbVector3 logic2pixelPos(EbVector3 logic_pos)
 {
     return(game_area2screen_pos(logic2game_area_pos(logic_pos)));
 }
示例#59
0
 //-------------------------------------------------------------------------
 public void setPosition(EbVector3 position, float angle)
 {
     mCSpriteNumber.setPosition(position, angle);
     mNumberBackgroundCSprite.setPosition(position);
     mNumberBackgroundCSprite.setDirection(angle);
 }
示例#60
0
 public void setPosition(EbVector3 position, float angle)
 {
     mPosition = position;
     mAngle    = angle;
     _updateView();
 }