Beispiel #1
0
        public void CartShouldNotBeAbleToEnter()
        {
            var level = correct;

            var cart = new BaseCart();
            var track = level.Tracks[1];

            cart.Current = track;
            track.Cart = cart;

            Assert.IsFalse(track.CanEnter(cart), "The cart should not be able to enter.");
        }
Beispiel #2
0
        public void CartShouldBeAbleToEnter()
        {
            var level = correct;

            var cart = new BaseCart();
            var tracks = level.Tracks;

            cart.Current = tracks[1];
            tracks[1].Cart = cart;

            Assert.IsTrue(tracks[0].CanEnter(cart), "The cart should be able to enter.");
        }
Beispiel #3
0
        public void CartShouldThrowException()
        {
            var level = correct;
            var tracks = level.Tracks;

            var cart1 = new BaseCart();
            var cart2 = new BaseCart();

            tracks[0].Cart = cart1;
            cart1.Current = tracks[0];

            tracks[1].Cart = cart2;
            cart2.Current = tracks[1];

            cart1.IgnoreTick = true;
            cart1.Update();
        }
Beispiel #4
0
 public override void OnEnter(BaseCart cart)
 {
     cart?.Dispose();
 }
Beispiel #5
0
        private void Spawn()
        {
            if (_steps != _maxSteps)
                return;

            var index = random.Next(0, level.Depots.Length);
            var cart = new BaseCart();
            cart.Current = level.Depots[index];

            level.Carts.Add(cart);
        }
Beispiel #6
0
 public virtual bool CanEnter(BaseCart cart)
 {
     return !Occupied;
 }
Beispiel #7
0
 public virtual void OnLeave()
 {
     _cart = null;
 }
Beispiel #8
0
        public virtual void OnEnter(BaseCart cart)
        {
            if (cart == null)
                throw new ArgumentNullException("cart");

            _cart = cart;
        }
 public override bool CanEnter(BaseCart cart)
 {
     return !Occupied
         && (Compare(cart.Current.Position) == _mode);
 }