コード例 #1
0
 /// <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);
 }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
 public Residence(ResidenceType type, int numberOfBedrooms, bool hasGarage)
 {
     this.type             = type;
     this.numberOfBedrooms = numberOfBedrooms;
     this.hasGarage        = hasGarage;
 }
コード例 #4
0
 public Residence(ResidenceType type, int numberOfBedrooms)
 {
     this.type             = type;
     this.numberOfBedrooms = numberOfBedrooms;
 }
コード例 #5
0
 /// <summary>
 /// Set the destination for the order
 /// </summary>
 /// <param name="residence"></param>
 public void SetDestination(ResidenceType residence)
 {
     orderView.SetDestination(residence.ToString());
     orderModel.SetDestination(residence);
 }
コード例 #6
0
 public void Update(ResidenceType residenceype)
 {
     _uow.Repository <ResidenceType>().Update(residenceype);
 }
コード例 #7
0
 public async Task <ResidenceType> Add(ResidenceType residenceype)
 {
     return(await _uow.Repository <ResidenceType>().Insert(residenceype));
 }