/// <summary> /// Is used to set the destination for an order /// </summary> /// <param name="order"></param> /// <param name="residence"></param> private void SetDestination(OrderController order, ResidenceType residence) { order.SetDestination(residence); }
/// <summary> /// Start is called on the frame when a script is enabled just before /// any of the Update methods is called the first time. /// </summary> private void Start() { orders = new List<OrderController>(); speed = 1; panelWidth = orderPanel.rectTransform().sizeDelta.x; panelHeight = orderPanel.rectTransform().sizeDelta.y; panelXpos = orderPanel.rectTransform().anchoredPosition.x; panelYpos = orderPanel.rectTransform().anchoredPosition.y; int randomValue = Random.Range(minTime, maxTime); MessageBroker.Default.Receive<AppStateMessage>().Subscribe(message => { if (message.AppState == AppState.PlayGame) { //use order spawn service to spawn new timerMessage = MessageBroker.Default.Receive<TimerMessage>().Subscribe(tick => { //first spawn if (orders.Count <= 0) { SpawnOrder(OrderType.normal, orderPanel.transform); randomValue = Random.Range(minTime, maxTime); } if (orders.Count < 3) { if (randomValue <= 0) { SpawnOrder(OrderType.normal, orderPanel.transform); randomValue = Random.Range(minTime, maxTime); } randomValue--; } }).AddTo(this); } else { timerMessage?.Dispose(); DespawnOrder(null); orders.Clear(); } }).AddTo(this); MessageBroker.Default.Receive<OrderTimesUpMessage>().Subscribe(message => { if (message.TimesUp) { int index = 0; foreach (var order in orders) { if (order.GetTime() <= 0) { orders.RemoveAt(index); StartDespawnAnimation(order); DecreaseScore(1); break; } index++; } } }).AddTo(this); MessageBroker.Default.Receive<CheckOrderMessage>().Subscribe(message => { int cargoAmount = message.Amount; OilType cargoOilType = message.Oil; ResidenceType cargoDestination = message.Residence; Debug.Log(cargoDestination); CheckOrder(cargoDestination, cargoOilType, cargoAmount); }).AddTo(this); }
public Residence(ResidenceType type, int numberOfBedrooms, bool hasGarage) { this.type = type; this.numberOfBedrooms = numberOfBedrooms; this.hasGarage = hasGarage; }
public Residence(ResidenceType type, int numberOfBedrooms) { this.type = type; this.numberOfBedrooms = numberOfBedrooms; }
/// <summary> /// Set the destination for the order /// </summary> /// <param name="residence"></param> public void SetDestination(ResidenceType residence) { orderView.SetDestination(residence.ToString()); orderModel.SetDestination(residence); }
public void Update(ResidenceType residenceype) { _uow.Repository <ResidenceType>().Update(residenceype); }
public async Task <ResidenceType> Add(ResidenceType residenceype) { return(await _uow.Repository <ResidenceType>().Insert(residenceype)); }