Пример #1
0
        public void CloneTest()
        {
            Point2D s1 = new Point2D(1.1, 2.2);
            Point2D s2 = s1.Clone();

            Assert.Equal(s1, s2);
            Assert.NotSame(s1, s2);
        }
Пример #2
0
        public void CloneTest()
        {
            Point2D s1 = new Point2D(1.1, 2.2);
            Point2D s2 = s1.Clone();

            Assert.Equal(s1, s2);
            Assert.NotSame(s1, s2);
        }
Пример #3
0
        public void CloneTest()
        {
            Point2D p1 = new Point2D(1.1, 2.2);
            Point2D p2 = p1.Clone();

            Assert.Equal(p1, p2);
            Assert.NotSame(p1, p2);
        }
Пример #4
0
		public void CloneTest()
		{
			Point2D p1 = new Point2D(1.1, 2.2);
			Point2D p2 = p1.Clone();

			Assert.AreEqual(p1, p2);
			Assert.AreNotSame(p1, p2);
		}
Пример #5
0
        public void CloneTestSame()
        {
            var point       = new Point2D(6.21, -3.63);
            var clonedPoint = (Point2D)point.Clone();

            Assert.AreEqual(point.X, clonedPoint.X);
            Assert.AreEqual(point.Y, clonedPoint.Y);
        }
Пример #6
0
        public void CloneTestDifferent()
        {
            var point       = new Point2D(6.21, -3.63);
            var clonedPoint = (Point2D)point.Clone();

            clonedPoint.Y *= -2;

            Assert.AreEqual(point.X, clonedPoint.X);
            Assert.AreNotEqual(point.Y, clonedPoint.Y);
        }
Пример #7
0
        public void Clone_Always_ReturnNewInstanceWithCopiedValues()
        {
            // Setup
            var    random   = new Random(22);
            double x        = random.NextDouble();
            double y        = random.NextDouble();
            var    original = new Point2D(x, y);

            // Call
            object clone = original.Clone();

            // Assert
            CoreCloneAssert.AreObjectClones(original, clone, GeometryCloneAssert.AreClones);
        }
Пример #8
0
        public SC2APIProtocol.Action RetreatToChokePoint(Unit u)
        {
            SC2APIProtocol.Action answer = CreateAction(u, ABILITY_ID.MOVE);
            List <Unit>           CCs    = GetMyBases();
            Point2D pos = FindNearestRanmp(CCs[0]);

            if (pos != null)
            {
                Point2D offset   = rampData[pos].data["Rally"];
                Point2D rallyPos = pos.Clone();
                rallyPos.X += offset.X;
                rallyPos.Y += offset.Y;
                answer.ActionRaw.UnitCommand.TargetWorldSpacePos = rallyPos;
            }
            else
            {
                answer.ActionRaw.UnitCommand.TargetWorldSpacePos = CCs[0].Pos.ToPoint2D();
            }
            return(answer);
        }
Пример #9
0
 public SC2APIProtocol.Action SetRallyPoint(Unit cc)
 {
     if (!coolDownCommand.IsDelayed("SetRallyPoint"))
     {
         SC2APIProtocol.Action answer = CreateAction(cc, ABILITY_ID.RALLY_BUILDING);
         //Point2D pos = FindPlaceable((int)cc.Pos.X, (int)cc.Pos.Y, 10, 3);
         Point2D pos = FindNearestRanmp(cc);
         if (pos != null)
         {
             Point2D offset   = rampData[pos].data["Rally"];
             Point2D rallyPos = pos.Clone();
             rallyPos.X += offset.X;
             rallyPos.Y += offset.Y;
             coolDownCommand.Add(new CoolDownCommandData()
             {
                 key = "SetRallyPoint", finishStep = gameLoop + 10
             });
             logDebug("SetRallyPoint at " + rallyPos.ToString());
             answer.ActionRaw.UnitCommand.TargetWorldSpacePos = rallyPos;
             return(answer);
         }
     }
     return(null);
 }