//广播自己位置
        public void BroadcastSelfPostion(ObjCharacter _this)
        {
            if (!_this.mActive)
            {
                return;
            }
            if (null == _this.Zone)
            {
                return;
            }
            var msg = new SyncPostionMsg();

            msg.ObjId = _this.ObjId;
            msg.Pos   = new PositionData
            {
                Pos = new Vector2Int32
                {
                    x = Utility.MultiplyPrecision(_this.GetPosition().X),
                    y = Utility.MultiplyPrecision(_this.GetPosition().Y)
                },
                Dir = new Vector2Int32
                {
                    x = Utility.MultiplyPrecision(_this.GetDirection().X),
                    y = Utility.MultiplyPrecision(_this.GetDirection().Y)
                }
            };

            SceneServer.Instance.ServerControl.SyncStopMove(_this.EnumAllVisiblePlayerIdExclude(), msg);
        }
Exemple #2
0
        //广播地面火球效果
        private void PosGuideBefore(ObjCharacter caster, ObjPlayer target, Vector2 pos, int d)
        {
            //var mTable = Table.GetSkill(5150);
            if (target == null)
            {
                return;
            }
            var buffId   = 1060;
            var replyMsg = new BuffResultMsg();
            var temp     = new BuffResult
            {
                Type       = BuffType.HT_EFFECT,
                BuffTypeId = buffId,
                ViewTime   = Extension.AddTimeDiffToNet(d)
            };

            temp.Param.Add(5150);
            temp.TargetObjId = target.ObjId;
            temp.Param.Add((int)(pos.X * 100));
            temp.Param.Add((int)(pos.Y * 100));
            temp.Param.Add((int)(caster.GetDirection().X *1000));
            temp.Param.Add((int)(caster.GetDirection().Y *1000));
            temp.Param.Add(1500); //mTable.CastParam[1]
            replyMsg.buff.Add(temp);
            target.BroadcastBuffList(replyMsg);
            SceneServerControl.Timer.CreateTrigger(DateTime.Now.AddMilliseconds(1400 + d), () => { FireCast(pos); });
            if (MyRandom.Random(10000) < 5000)
            {
                DropItem(2, MyRandom.Random(MinGold, MaxGold), pos);

                var max = pos2.Count;
                if (IsInspired(target))
                {
                    max = Math.Max(GoldNumInspireMax, 0);
                }
                else
                {
                    max = Math.Max(GoldNumMax, 0);
                }
                // 修改掉落的堆数 走配置  跟是否鼓舞有关系
                oldList = pos2.RandRange(0, max);
                for (int i = 0; i < oldList.Count; ++i)
                {
                    DropItem(2, MyRandom.Random(MinGold, MaxGold), oldList[i]);
                }
            }
        }
        //使用技能广播
        public void BroadcastUseSkill(ObjCharacter _this, int skillId, ObjCharacter obj)
        {
            if (!_this.mActive)
            {
                return;
            }
            if (null == _this.Zone)
            {
                return;
            }
            ulong targetId = 0;

            if (obj != null)
            {
                targetId = obj.ObjId;
            }
            var msg = new CharacterUseSkillMsg();

            msg.CharacterId = _this.ObjId;
            msg.SkillId     = skillId;
            msg.TargetObjId.Add(targetId);
            msg.Pos = new PositionData
            {
                Pos = new Vector2Int32
                {
                    x = Utility.MultiplyPrecision(_this.GetPosition().X),
                    y = Utility.MultiplyPrecision(_this.GetPosition().Y)
                },
                Dir = new Vector2Int32
                {
                    x = Utility.MultiplyPrecision(_this.GetDirection().X),
                    y = Utility.MultiplyPrecision(_this.GetDirection().Y)
                }
            };

            if (ObjCharacter.BroadcastType == 1)
            {
                _this.Zone.PushSkillMsg(msg);
                return;
            }
            SceneServer.Instance.ServerControl.NotifyUseSkill(_this.EnumAllVisiblePlayerIdExclude(), msg);
        }
 //广播方向
 public void BroadcastDirection(ObjCharacter _this)
 {
     if (!_this.mActive)
     {
         return;
     }
     if (null == _this.Zone)
     {
         return;
     }
     SceneServer.Instance.ServerControl.SyncDirection(_this.EnumAllVisiblePlayerIdExclude(_this.ObjId),
                                                      _this.ObjId, Utility.MultiplyPrecision(_this.GetDirection().X),
                                                      Utility.MultiplyPrecision(_this.GetDirection().Y));
 }