Exemplo n.º 1
0
        public void BiteWhenThingIsInRangeAndFacingThing()
        {
            var cat          = ACat(withPosition: Vector3.zero, withBiteRange: 1, withFacingDirection: new Vector3(1, 0, 1));
            var inGameCat    = AnInGameCat(cat);
            var thingId      = 0;
            var thing        = AThing(withId: 0, withBittenStatus: false, withPosition: new Vector3(0.5f, 0, 0.5f));
            var inGameThings = new InGameThings(new[] { thing });
            var bite         = ABite(withInGameThings: inGameThings, withAnInGameCat: inGameCat);

            bite.Execute(thing);

            var actualValue   = inGameThings.Get(0);
            var expectedValue = AThing(withId: 0, withBittenStatus: true, withPosition: Vector3.zero);

            Assert.AreEqual(expectedValue, actualValue);
        }
Exemplo n.º 2
0
        public void DoNotBiteWhenIsNotFacingThingOnXAxis()
        {
            var cat           = ACat(withPosition: Vector3.zero, withBiteRange: 1, withFacingDirection: Vector3.forward);
            var inGameCat     = AnInGameCat(cat);
            var thingId       = 0;
            var thingPosition = new Vector3(-0.5f, 0, 0.5f);
            var thing         = AThing(withId: 0, withBittenStatus: false, withPosition: thingPosition);
            var inGameThings  = new InGameThings(new[] { thing });
            var bite          = ABite(withInGameThings: inGameThings, withAnInGameCat: inGameCat);

            bite.Execute(thing);

            var actualValue   = inGameThings.Get(0);
            var expectedValue = AThing(withId: 0, withBittenStatus: false, withPosition: thingPosition);

            Assert.AreEqual(expectedValue, actualValue);
        }
Exemplo n.º 3
0
 public static Bite ABite([CanBeNull] InGameThings withInGameThings = null,
                          [CanBeNull] InGameCat withAnInGameCat     = null) =>
 new Bite(withInGameThings, withAnInGameCat);
Exemplo n.º 4
0
 public Bite(InGameThings inGameThings, InGameCat inGameCat)
 {
     _inGameThings = inGameThings;
     _inGameCat    = inGameCat;
 }