コード例 #1
0
        public void ExpandSeeArea(Point position, Fraction fraction)
        {
            int sightRange = 8;

            for (int y = -sightRange; y < sightRange; y++)
            {
                for (int x = -sightRange; x < sightRange; x++)
                {
                    Point offset = new Point(x, y);
                    if (DistanceHelper.EuclideanDistance(offset) > sightRange)
                    {
                        continue;
                    }
                    Point visibleCell = position + offset;
                    if (visibleCell.X < 0 || visibleCell.X >= _grid.Size || visibleCell.Y < 0 ||
                        visibleCell.Y >= _grid.Size)
                    {
                        continue;
                    }

                    fraction.FogOfWar[visibleCell.X, visibleCell.Y] = 2;
                }
            }
        }
コード例 #2
0
 public void MoveInListener(MoveInEvent moveInEvent)
 {
     moveInEvent.MoveToNextEvent.Owner.GetComponent <GeoEntity>().Position   = moveInEvent.Current;
     moveInEvent.MoveToNextEvent.Owner.GetComponent <Army>().MovementPoints -=
         DistanceHelper.EuclideanDistance(moveInEvent.Current, moveInEvent.Previous);
 }