Example #1
0
        public void Show()
        {
            IUIMenu activeMenu;

            DisplayHelper.Spacing();
            var startingPosition = (Console.CursorLeft, Console.CursorTop);

            //run loop
            while (true)
            {
                PurchaseActions selectedAction = DisplayHelper.GetAction <PurchaseActions, PurchaseUI>();
                switch (selectedAction)
                {
                case PurchaseActions.Buy_Box:
                    activeMenu = new BuyBoxUI();
                    break;

                case PurchaseActions.Buy_Box_For_Present:
                    activeMenu = new BuyBoxForPresentUI();
                    break;

                case PurchaseActions.Back:
                    DisplayHelper.Close();
                    return;

                default:
                    DisplayHelper.Invalid();
                    continue;
                }
                activeMenu.Show();
                //Reset cursor to starting position while clearing thae path
                DisplayHelper.ClearBackTo(startingPosition);
            }
        }
Example #2
0
 private Actions(PurchaseActions pActions, UserActions uActions, StoreActions sActions, NotificationManager notification)
 {
     Purchase     = pActions;
     User         = uActions;
     Store        = sActions;
     Notification = notification;
 }
Example #3
0
    protected void QueueChanged()
    {
        stateMachine.taskDestinationPosition = register.GetCustomerQueuePostion(stateMachine.gameObject);

        stateMachine.navMeshAgent.SetDestination(stateMachine.taskDestinationPosition);

        currentAction = PurchaseActions.Moving;
    }
Example #4
0
    protected void CashingOut()
    {
        if (Vector3.Distance(stateMachine.transform.position, register.transform.position)
            < 2.0f && register.GetCustomerQueueRank(stateMachine.gameObject) == 0)
        {
            currentAction = PurchaseActions.Purchasing;
        }

        if (currentAction == PurchaseActions.Purchasing)
        {
            isDonePurchasing = true;
        }
    }
Example #5
0
    public virtual void StartState()
    {
        // Reset variables
        currentAction = PurchaseActions.None;
        stateMachine.taskDestination         = null;
        stateMachine.taskDestinationPosition = Vector3.zero;
        register = null;

        isDonePurchasing = false;

        patienceTimer = stateMachine.queuingPatience;

        waitTime = stateMachine.purchaseDuration;

        stateMachine.billboardCanvas.gameObject.SetActive(true);
        stateMachine.patienceAnimator.SetBool(show, false);
        stateMachine.billboardAnimator.SetBool(show, false);
    }
Example #6
0
    public virtual void UpdateActions()
    {
        switch (currentAction)
        {
        // Setup goal for AI
        case PurchaseActions.None:
        {
            bool result = SetupDestination();

            if (result)
            {
                stateMachine.navMeshAgent.SetDestination(stateMachine.taskDestinationPosition);
                currentAction = PurchaseActions.Moving;
            }
            break;
        }

        // Walking to destination
        case PurchaseActions.Moving:
        {
            // Hide patients
            stateMachine.billboardAnimator.SetBool(show, false);

            // Remove patience indicator
            stateMachine.patienceAnimator.SetBool(show, false);

            // Change action state when close to the destination
            if (stateMachine.navMeshAgent.remainingDistance < stateMachine.maxPickupDistance)
            {
                currentAction = PurchaseActions.Turning;
            }
            break;
        }

        // Turn towards destination
        case PurchaseActions.Turning:
        {
            // Calculate direction to target
            int rank = register.GetCustomerQueueRank(stateMachine.gameObject);

            var target = rank != 0 ? register.GetFrontOfLinePosition() : stateMachine.taskDestination.position;

            float fromToDelta = EssentialFunctions.RotateTowardsTargetSmoothDamp(stateMachine.transform,
                                                                                 target,
                                                                                 ref _angularVelocity,
                                                                                 stateMachine.rotationSpeed);

            // Stop rotation if angle between target and forward vector is lower than margin of error
            if (fromToDelta <= MARGIN_OF_ERROR_AMOUNT)
            {
                currentAction = PurchaseActions.Queuing;
            }

            break;
        }

        case PurchaseActions.Queuing:
            break;

        case PurchaseActions.Purchasing:
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }
    }
Example #7
0
 internal static void SetUp(PurchaseActions pActions, UserActions uActions, StoreActions sActions, NotificationManager notification)
 {
     instance = new Actions(pActions, uActions, sActions, notification);
 }