コード例 #1
0
        private bool ImpactBeamTargets(Bullet bullet)
        {
            BoardCellDynamicArray beamNearbyCells = bullet.GetBeamNearbyCells();

            if (beamNearbyCells.Array == null)
            {
                return(false);
            }
            for (int i = 0; i < beamNearbyCells.Length; i++)
            {
                BoardCell boardCell = beamNearbyCells.Array[i];
                if (boardCell.Children != null)
                {
                    int beamDamagePercent = bullet.GetBeamDamagePercent(boardCell.X, boardCell.Z);
                    if (beamDamagePercent != 0)
                    {
                        for (LinkedListNode <BoardItem> linkedListNode = boardCell.Children.First; linkedListNode != null; linkedListNode = linkedListNode.Next)
                        {
                            SmartEntity target = (SmartEntity)linkedListNode.Value.Data;
                            bullet.ApplyBeamDamagePercent(target, beamDamagePercent);
                        }
                    }
                }
            }
            foreach (BeamTarget current in bullet.BeamTargets.Values)
            {
                if (current.HitThisSegment)
                {
                    bullet.SetTarget(current.Target);
                    this.ImpactSingleTarget(bullet, current.CurDamagePercent, false, true);
                    bullet.SetTarget(null);
                }
                current.OnBeamAdvance();
            }
            bullet.AdvanceBeam();
            return(true);
        }
コード例 #2
0
        private bool ImpactBeamTargets(Bullet bullet)
        {
            List <BoardCell <Entity> > beamNearbyCells = bullet.GetBeamNearbyCells();

            if (beamNearbyCells == null)
            {
                return(false);
            }
            foreach (BoardCell <Entity> current in beamNearbyCells)
            {
                if (current.Children != null)
                {
                    int beamDamagePercent = bullet.GetBeamDamagePercent(current.X, current.Z);
                    if (beamDamagePercent != 0)
                    {
                        for (LinkedListNode <BoardItem <Entity> > linkedListNode = current.Children.First; linkedListNode != null; linkedListNode = linkedListNode.Next)
                        {
                            SmartEntity target = (SmartEntity)linkedListNode.Value.Data;
                            bullet.ApplyBeamDamagePercent(target, beamDamagePercent);
                        }
                    }
                }
            }
            foreach (BeamTarget current2 in bullet.BeamTargets.Values)
            {
                if (current2.HitThisSegment)
                {
                    bullet.SetTarget(current2.Target);
                    this.ImpactSingleTarget(bullet, current2.CurDamagePercent, false, true);
                    bullet.SetTarget(null);
                }
                current2.OnBeamAdvance();
            }
            bullet.AdvanceBeam();
            return(true);
        }