コード例 #1
0
        public void TargetObject(IGalaxy galaxy, Position pos)
        {
            var previous = SelectedObject;
            var target   = galaxy.ClosestSpaceObject(pos);

            if (target != null)
            {
                SelectedObject = target;
                Objects        = galaxy.GetSpaceObjectsAt(target.Position).ToArray();

                if (previous?.Position == target.Position)
                {
                    SelectedObject = Objects
                                     .SkipWhile(obj => obj.ObjectId != previous.ObjectId)
                                     .Skip(1)
                                     .FirstOrDefault();
                }

                OnChange();
            }
        }