Esempio n. 1
0
        /// <summary>
        /// Is called when spawned order controller received
        /// </summary>
        /// <param name="orderController"></param>
        private void OnOrderControllerReceived(OrderController orderController)
        {
            TurnOff(orderController.GetCanvasGroup());
            StartSpawnAnimation(orderController);
            orders.Add(orderController);
            RescaleOrderPanel();
            //set the order's information randomly


            ResidenceType randomResidence =
                (ResidenceType) Random.Range(0, System.Enum.GetValues(typeof(ResidenceType)).Length);

            SetOrder(orderController, OilType.ProcessedOil, 2);
            SetDestination(orderController, randomResidence);
        }
Esempio n. 2
0
 /// <summary>
 /// start spawn fade animation
 /// </summary>
 /// <param name="order"></param>
 public void StartSpawnAnimation(OrderController order)
 {
     CanvasGroup canvasGroup = order.GetCanvasGroup();
     float scale;
     spawnEffect = this.UpdateAsObservable().Subscribe(_ =>
         {
             scale = speed * Time.deltaTime;
             canvasGroup.alpha += scale;
             if (canvasGroup.alpha >= 1)
             {
                 spawnEffect?.Dispose();
             }
         })
         .AddTo(this);
 }