Ejemplo n.º 1
0
        public CustomMouseCursor(FrameworkElement parent, ArcBot player)
        {
            _parent = parent;
            _player = player;

            parent.MouseMove  += Parent_MouseMove;
            parent.MouseEnter += Parent_MouseEnter;
            parent.MouseLeave += Parent_MouseLeave;

            _children = new VisualCollection(this);
            var ellipse = CreateEllipse(30);

            _brush = ellipse.Item2;
            _children.Add(ellipse.Item1);

            this.Width  = 30;
            this.Height = 30;

            this.HorizontalAlignment = HorizontalAlignment.Left;
            this.VerticalAlignment   = VerticalAlignment.Top;

            this.IsHitTestVisible = false;
            this.Cursor           = Cursors.None;
            _parent.Cursor        = Cursors.None;

            // Transform
            _scale     = new ScaleTransform(1, 1);
            _translate = new TranslateTransform(0, 0);
            TransformGroup transform = new TransformGroup();

            transform.Children.Add(_scale);
            transform.Children.Add(_translate);
            this.RenderTransform = transform;
        }
Ejemplo n.º 2
0
        public RamWeapon(RamWeaponDNA dna, ArcBot bot, Viewport3D viewport)
        {
            _bot      = bot;
            _viewport = viewport;

            this.DNA = dna;
        }
Ejemplo n.º 3
0
        public FitnessRule_TooStill(ArcBot bot, double stationarySpeed, double maxAllowedStationaryTime)
        {
            this.Bot = bot;

            _stationarySpeed          = stationarySpeed;
            _maxAllowedStationaryTime = maxAllowedStationaryTime;
        }
Ejemplo n.º 4
0
        public FitnessRule_TooFar(ArcBot bot, Point3D center, double maxSafeDistance, double maxUnsafeDistance)
        {
            this.Bot = bot;

            _center            = center;
            _maxSafeDistance   = maxSafeDistance;
            _maxUnsafeDistance = maxUnsafeDistance;
        }
Ejemplo n.º 5
0
        public FitnessRule_TooFar(ArcBot bot, Point3D center, double maxSafeDistance, double maxUnsafeDistance)
        {
            this.Bot = bot;

            _center = center;
            _maxSafeDistance = maxSafeDistance;
            _maxUnsafeDistance = maxUnsafeDistance;
        }
Ejemplo n.º 6
0
            private FitnessTracker GetRules(ArcBot bot = null)
            {
                //TODO: Base this on a tempate that was passed into the constructor

                List<Tuple<IFitnessRule, double>> rules = new List<Tuple<IFitnessRule, double>>();

                rules.Add(new Tuple<IFitnessRule, double>(new FitnessRule_TooFar(bot, new Point3D(0, 0, 0), HOMINGRADIUS, HOMINGRADIUS * 2d), 1d));
                rules.Add(new Tuple<IFitnessRule, double>(new FitnessRule_TooStill(bot, .1, 1), 1d));
                rules.Add(new Tuple<IFitnessRule, double>(new FitnessRule_TooTwitchy(bot, -.8), 1d));

                return new FitnessTracker(bot, rules.ToArray());
            }
Ejemplo n.º 7
0
            private FitnessTracker GetRules(ArcBot bot = null)
            {
                //TODO: Base this on a tempate that was passed into the constructor

                List <Tuple <IFitnessRule, double> > rules = new List <Tuple <IFitnessRule, double> >();

                rules.Add(new Tuple <IFitnessRule, double>(new FitnessRule_TooFar(bot, new Point3D(0, 0, 0), HOMINGRADIUS, HOMINGRADIUS * 2d), 1d));
                rules.Add(new Tuple <IFitnessRule, double>(new FitnessRule_TooStill(bot, .1, 1), 1d));
                rules.Add(new Tuple <IFitnessRule, double>(new FitnessRule_TooTwitchy(bot, -.8), 1d));

                return(new FitnessTracker(bot, rules.ToArray()));
            }
Ejemplo n.º 8
0
        private readonly double _ruleCount;     // storing this as a double to speed up the score get

        #endregion

        #region Constructor

        public FitnessTracker(ArcBot bot, Tuple <IFitnessRule, double>[] rules)
        {
            if (bot != null)
            {
                if (rules.Any(o => o.Item1.Bot.Token != bot.Token))
                {
                    throw new ArgumentException("All rules must be for the same bot");
                }
            }

            this.Bot = bot;

            _rules     = rules;
            _ruleCount = _rules.Length;
        }
Ejemplo n.º 9
0
        public void ShowInventories(Shop shop, ArcBot bot)
        {
            _shop = shop;
            _bot  = bot;
            _animationRotates.Clear();

            if (bot.Weapon == null)
            {
                this.AttachedWeaponID = null;
            }
            else
            {
                this.AttachedWeaponID = bot.Weapon.DNA.UniqueID;
                bot.AttachWeapon(null, ItemToFrom.Nowhere, ItemToFrom.Inventory);
            }

            //TODO: When the user can create weapons in the shop, this will need to be recalculated, and all item cameras need to be adjusted
            double maxWeaponRadius = UtilityCore.Iterate(shop.Inventory.Weapons, bot.Inventory.Weapons).Max(o => o.Radius);

            LoadInventory(lstShopInventory, shop.Inventory, _animationRotates, maxWeaponRadius);
            LoadInventory(lstBotInventory, bot.Inventory, _animationRotates, maxWeaponRadius);
        }
Ejemplo n.º 10
0
        public CustomMouseCursor(FrameworkElement parent, ArcBot player)
        {
            _parent = parent;
            _player = player;

            parent.MouseMove += Parent_MouseMove;
            parent.MouseEnter += Parent_MouseEnter;
            parent.MouseLeave += Parent_MouseLeave;

            _children = new VisualCollection(this);
            var ellipse = CreateEllipse(30);
            _brush = ellipse.Item2;
            _children.Add(ellipse.Item1);

            this.Width = 30;
            this.Height = 30;

            this.HorizontalAlignment = HorizontalAlignment.Left;
            this.VerticalAlignment = VerticalAlignment.Top;

            this.IsHitTestVisible = false;
            this.Cursor = Cursors.None;
            _parent.Cursor = Cursors.None;

            // Transform
            _scale = new ScaleTransform(1, 1);
            _translate = new TranslateTransform(0, 0);
            TransformGroup transform = new TransformGroup();
            transform.Children.Add(_scale);
            transform.Children.Add(_translate);
            this.RenderTransform = transform;
        }
Ejemplo n.º 11
0
        public FitnessRule_TooTwitchy(ArcBot bot, double minDot)
        {
            this.Bot = bot;

            _minDot = minDot;
        }
Ejemplo n.º 12
0
        private readonly double _ruleCount;     // storing this as a double to speed up the score get

        #endregion

        #region Constructor

        public FitnessTracker(ArcBot bot, Tuple<IFitnessRule, double>[] rules)
        {
            if (bot != null)
            {
                if (rules.Any(o => o.Item1.Bot.Token != bot.Token))
                {
                    throw new ArgumentException("All rules must be for the same bot");
                }
            }

            this.Bot = bot;

            _rules = rules;
            _ruleCount = _rules.Length;
        }
Ejemplo n.º 13
0
        public FitnessRule_TooTwitchy(ArcBot bot, double minDot)
        {
            this.Bot = bot;

            _minDot = minDot;
        }
Ejemplo n.º 14
0
        public FitnessRule_TooStill(ArcBot bot, double stationarySpeed, double maxAllowedStationaryTime)
        {
            this.Bot = bot;

            _stationarySpeed = stationarySpeed;
            _maxAllowedStationaryTime = maxAllowedStationaryTime;
        }
Ejemplo n.º 15
0
        public RamWeapon(RamWeaponDNA dna, ArcBot bot, Viewport3D viewport)
        {
            _bot = bot;
            _viewport = viewport;

            this.DNA = dna;
        }