예제 #1
0
        public void Move(Hockeyist self, World world, Game game, Move move)
        {
            world.SetCurrent();
            game.SetCurrent();

            if (!behaviours.ContainsKey(self.Id))                //do we need to init behaviour?
            {
                HockeyistBehaviour b = null;
                if (self.IsHunter())
                {
                    b = new HunterBehaviour(self);
                }
                else
                {
                    b = new DefenseBehaviour(self);
                }
                behaviours[self.Id] = b.Perform().GetEnumerator();
            }

            {             //take corresponding actions
                var enumerator = behaviours [self.Id];
                enumerator.MoveNext();
                enumerator.Current(move);
                return;
            }

//            const double speedKp = 0.005;
//            speedPID = new PID(speedKp, 1.0D);

            // TODO: Angle Max Output

            /*
             * const double angleKp = 0.5;
             * anglePID = new PID(angleKp, 1.0D);
             */

//            strikeDistanceFromNet = 385;
//            var opponentNetFront = _world.GetOpponentPlayer().NetFront;
//            attackLine = opponentNetFront - strikeDistanceFromNet < 0
//                ? opponentNetFront + strikeDistanceFromNet
//                : opponentNetFront - strikeDistanceFromNet;

//            attackPath = new Point[]
//            {
//                new Point(700, 250),
//                new Point(400, 250),
//            };


//            decelerateLine = 550;
//            minStrikeLine = 200;

//            if (IsHunter())
            {
//                PerformAttack();

                /*
                 * if (world.Puck.OwnerHockeyistId == self.Id)
                 * {
                 *  PassThePuck();
                 * }
                 * else
                 * {
                 *  GoGetThePuck();
                 * }
                 */
            }
        }
예제 #2
0
        public void Move(Hockeyist self, World world, Game game, Move move)
        {
			world.SetCurrent();
			game.SetCurrent();

			if (!behaviours.ContainsKey (self.Id)) { //do we need to init behaviour?
				HockeyistBehaviour b = null;
				if (self.IsHunter ()) {
					b = new HunterBehaviour (self);
				} else {
					b = new DefenseBehaviour (self);
				}
				behaviours[self.Id] = b.Perform().GetEnumerator();
			} 

			{ //take corresponding actions
				var enumerator = behaviours [self.Id];
				enumerator.MoveNext ();
				enumerator.Current (move);
				return;
			}

//            const double speedKp = 0.005;
//            speedPID = new PID(speedKp, 1.0D);

            // TODO: Angle Max Output
            /*
            const double angleKp = 0.5;
            anglePID = new PID(angleKp, 1.0D);
             */

//            strikeDistanceFromNet = 385;
//            var opponentNetFront = _world.GetOpponentPlayer().NetFront;
//            attackLine = opponentNetFront - strikeDistanceFromNet < 0
//                ? opponentNetFront + strikeDistanceFromNet
//                : opponentNetFront - strikeDistanceFromNet;

//            attackPath = new Point[]
//            {
//                new Point(700, 250),
//                new Point(400, 250), 
//            };
				
            
//            decelerateLine = 550;
//            minStrikeLine = 200;

//            if (IsHunter())
            {
//                PerformAttack();
                /*
                if (world.Puck.OwnerHockeyistId == self.Id)
                {
                    PassThePuck();
                }
                else
                {
                    GoGetThePuck();
                }  
                 */
            }
        }