示例#1
0
文件: Mower.cs 项目: burrowsj/PC
        public Mower(IGarden garden, CoOrdinate position, char heading) {

            _garden = garden;

            Position = position;

            Heading = heading;

        }
示例#2
0
        protected override Task OnActivateAsync()
        {
            if (!(this.StateManager.ContainsStateAsync("CurrentLocation").Result))
            {
                this.StateManager.AddStateAsync("CurrentLocation", Location.Outside);

                this.House   = ActorProxy.Create <IHouse>(new ActorId(100), "fabric:/FabricSmartHome");
                this.Garden  = ActorProxy.Create <IGarden>(new ActorId(101), "fabric:/FabricSmartHome");
                this.Kitchen = ActorProxy.Create <IKitchen>(new ActorId(102), "fabric:/FabricSmartHome");
                this.Bedroom = ActorProxy.Create <IBedroom>(new ActorId(103), "fabric:/FabricSmartHome");

                this.RegisterReminderAsync("HandleMovementTimeout", null, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5));
                this.RegisterReminderAsync("HandleActionTimeout", null, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5));
            }

            return(base.OnActivateAsync());
        }
示例#3
0
        /// <summary>
        /// Gets Daisy's position
        /// </summary>
        /// <param name="garden">Garden</param>
        /// <returns>Daisy's position if successful, otherwise position zero</returns>
        private static IPosition GetDaisysPosition(IGarden garden)
        {
            IPosition ret = null;

            Assert.IsNotNull(garden);
            foreach (IEntity entity in garden.Entities)
            {
                Assert.IsNotNull(entity);
                if (entity.Type == EEntityType.Daisy)
                {
                    ret = entity.Position;
                    break;
                }
            }
            Assert.IsNotNull(ret);
            return(ret);
        }
示例#4
0
文件: Mower.cs 项目: burrowsj/PC
        public Mower(IGarden garden):this(garden, new CoOrdinate {X=0, Y=0 }, 'N')
        {

        }