コード例 #1
0
ファイル: Bullet.cs プロジェクト: tuita520/mmorpgserver
        //创建子弹(靠目标)
        public TargetBullet CreateBullet(ObjCharacter caster,
                                         int BulletId,
                                         int nLevel,
                                         eSkillHitType hitType,
                                         ObjCharacter target)
        {
            var tbbullet = Table.GetBullet(BulletId);

            if (tbbullet == null)
            {
                return(null);
            }
            if (target == null)
            {
                return(null);
            }
            if (tbbullet.AttackMonsterID[0] != -1)
            {
                foreach (var i in tbbullet.AttackMonsterID)
                {
                    if (target.TypeId == i)
                    {
                        return(new TargetBullet(caster, tbbullet, nLevel, hitType, target));
                    }
                }
                return(null);
            }
            return(new TargetBullet(caster, tbbullet, nLevel, hitType, target));
        }
コード例 #2
0
ファイル: Bullet.cs プロジェクト: tuita520/mmorpgserver
 public DirectionBullet(ObjCharacter caster,
                        BulletRecord tbbullet,
                        int nLevel,
                        eSkillHitType hitType,
                        Vector2 direction)
 {
     mImpl.InitDirectionBullet(this, caster, tbbullet, nLevel, hitType, direction);
 }
コード例 #3
0
ファイル: Bullet.cs プロジェクト: tuita520/mmorpgserver
 public TargetBullet(ObjCharacter caster,
                     BulletRecord tbbullet,
                     int nLevel,
                     eSkillHitType hitType,
                     ObjCharacter target)
 {
     mImpl.InitTargetBullet(this, caster, tbbullet, nLevel, hitType, target);
 }
コード例 #4
0
ファイル: Bullet.cs プロジェクト: tuita520/mmorpgserver
 //创建子弹(靠目标)
 public static TargetBullet CreateBullet(ObjCharacter caster,
                                         int BulletId,
                                         int nLevel,
                                         eSkillHitType hitType,
                                         ObjCharacter target)
 {
     return(mImpl.CreateBullet(caster, BulletId, nLevel, hitType, target));
 }
コード例 #5
0
ファイル: Bullet.cs プロジェクト: tuita520/mmorpgserver
 //创建子弹(靠方向)
 public static DirectionBullet CreateBullet(ObjCharacter caster,
                                            int BulletId,
                                            int nLevel,
                                            eSkillHitType hitType,
                                            Vector2 direction)
 {
     return(mImpl.CreateBullet(caster, BulletId, nLevel, hitType, direction));
 }
コード例 #6
0
ファイル: Bullet.cs プロジェクト: tuita520/mmorpgserver
        public void InitTargetBullet(TargetBullet _this,
                                     ObjCharacter caster,
                                     BulletRecord tbbullet,
                                     int nLevel,
                                     eSkillHitType hitType,
                                     ObjCharacter target)
        {
            _this.Type        = 0;
            _this.Caster      = caster;
            _this.Target      = target;
            _this.TableBullet = tbbullet;
            _this.HitType     = hitType;
            foreach (var i in tbbullet.Buff)
            {
                _this.Buff[i] = nLevel;
            }
            double delaytime = (_this.Caster.GetPosition() - _this.Target.GetPosition()).Length() /
                               _this.TableBullet.Speed;
            var DelaySecond = (int)(delaytime * 1000);

            DelaySecond = DelaySecond - 100; //减去100毫秒的延迟
            DelaySecond = DelaySecond + tbbullet.ShotDelay;
            if (DelaySecond > 300)
            {
                _this.ArriveTrigger = SceneServerControl.Timer.CreateTrigger(DateTime.Now.AddMilliseconds(DelaySecond),
                                                                             () => { _this.DelayArrive(); });
                target.PushBullet(_this);
                //CoroutineFactory.NewCoroutine(TimeTrigger).MoveNext();
                Logger.Info("TargetBullet From={0} To={1} Bullet={2}", _this.Caster.ObjId, target.ObjId, tbbullet.Id);
                caster.BroadcastShootBullet(tbbullet.Id, caster.ObjId, target.ObjId, tbbullet.ShotDelay);
            }
            else
            {
                caster.BroadcastShootBullet(tbbullet.Id, caster.ObjId, target.ObjId, tbbullet.ShotDelay);
                var hitResult = _this.Caster.Attr.GetHitResult(_this.Target, _this.HitType);
                if (DelaySecond > 0)
                {
                    foreach (var i in _this.Buff)
                    {
                        _this.Target.AddBuff(i.Key, i.Value, _this.Caster, DelaySecond, hitResult, _this.Modify);
                    }
                }
                else
                {
                    foreach (var i in _this.Buff)
                    {
                        _this.Target.AddBuff(i.Key, i.Value, _this.Caster, 0, hitResult, _this.Modify);
                    }
                }
            }
        }
コード例 #7
0
ファイル: Bullet.cs プロジェクト: tuita520/mmorpgserver
        //创建子弹(靠方向)
        public DirectionBullet CreateBullet(ObjCharacter caster,
                                            int BulletId,
                                            int nLevel,
                                            eSkillHitType hitType,
                                            Vector2 direction)
        {
            var tbbullet = Table.GetBullet(BulletId);

            if (tbbullet == null)
            {
                return(null);
            }
            return(new DirectionBullet(caster, tbbullet, nLevel, hitType, direction));
        }
コード例 #8
0
ファイル: Bullet.cs プロジェクト: tuita520/mmorpgserver
 public void InitDirectionBullet(DirectionBullet _this,
                                 ObjCharacter caster,
                                 BulletRecord tbbullet,
                                 int nLevel,
                                 eSkillHitType hitType,
                                 Vector2 direction)
 {
     _this.Type        = 1;
     _this.Caster      = caster;
     _this.Direction   = direction;
     _this.TableBullet = tbbullet;
     _this.HitType     = hitType;
     foreach (var i in tbbullet.Buff)
     {
         _this.Buff[i] = nLevel;
     }
     //需要飞行计算
 }