Exemple #1
0
    public void CreateTicket()
    {
        CreateOrder();

        Debug.Log("ORDER COUNT AT TICKET CREATION: " + Orders.Count);
        Debug.Log("INDEXER FOR TICKET BEING CREATED, THIS SHOULD BE RAILINDEX OF PREVIOUS TICKET + 1(RIGHT???) :" + indexer.ToString());
        currentPos   = railPosition[indexer];
        HiddenOrders = SammichHelper.HideKeys(Orders);

        Ticket  newTicket = new Ticket();
        Vector2 tempPos   = currentPos + new Vector2(0f, -10f);

        if (Orders.Count > 1)
        {
            ticketList.Add(newTicket.PrintTicket2(ProperDick[Orders[0]], HiddenOrders[0], currentPos, indexer, ProperDick2[Orders[1]], HiddenOrders[1], tempPos));
        }
        else
        {
            ticketList.Add(newTicket.PrintTicket1(ProperDick[Orders[0]], HiddenOrders[0], currentPos, indexer));
        }

        if (ticketList.Count > LoseCon)
        {
            FindObjectOfType <GameManager>().EndGame();
        }
    }
Exemple #2
0
    public int IsMatchedOn(string key)
    {
        orders = ticketController.gameObject.GetComponent <Tickets>().Orders;
        SammichHelper.PrintAList("IS MATCHED ON ORDER!!!!!!!!!!!!!!!!!!!!!: ", orders);
        Debug.Log("ORDER KEY IN ISMATCH!!!!!!!!!!!!!!!!!!!!!!: " + key);

        for (int i = 0; i < orders.Count; i++)
        {
            if (key == orders[i])
            {
                orders.RemoveAt(i);

                Debug.Log("IS MATCH ORDERS.COUNT: " + orders.Count + "????????");
                break;
            }
        }
        if ((orders.Count) == 0)
        {
            isMatch.text = "GOT IT";
            Debug.Log("IF YOU SEE THIS YOU SHOULD ALSO BE SEEING GOT IT");
            Debug.Log(" ORDERS COUNT AFTER ISMATCH: " + orders.Count);
        }
        //isMatch.text = "GOT IT";

        return(0);
    }
Exemple #3
0
    /* Logic is as follows:
     * If it's the first ticket - Set firstPos to be the OrderGameObject. Create a GameObject newTicket and instantiate it on top of the
     *                            order prefab
     *
     *                            Then render the sprite on top of that new GameObject. It is assigned the proper dictionary, passing the
     *                            first element in the Orders List, which holds the keys we created earlier. We're just passing a random key
     *                            into an appropriate dictionary just like in Assemble(), only the key in Assemble() (samKey) is generated by
     *                            the ID's of objects on your (sandwhich) stack.
     *
     *                            Check the losing condition
     *
     * Else                       Do the same shit, but update the relative positions ( as they will change as time progresses), and access
     *                            the second dictionary  (ProperDick2).                                                                      */

    public void CreateTicket()
    {
        CreateOrder();

        if (firstTicket == true)
        {
            firstPos = GameObject.Find("OrderGO").transform.position;
            GameObject newTicket = Instantiate(OrderPreFab, firstPos, Quaternion.identity);
            newTicket.GetComponent <SpriteRenderer>().sprite = ProperDick[Orders[0]];
            ticketList.Add(newTicket);
            newTicket.GetComponent <IDscript>().ID = Orders[0];

            if (itemsPerTicket > 1)
            {
                firstItemPos  = ticketList[ticketList.Count - 1].transform.position;
                secondItemPos = firstItemPos + temp2;
                GameObject SecondItem = Instantiate(OrderPreFab, secondItemPos, Quaternion.identity);
                SecondItem.GetComponent <SpriteRenderer>().sprite = ProperDick2[Orders[1]];

                SecondItem.GetComponent <IDscript>().ID = Orders[1];
            }
            if (ticketList.Count > LoseCon)
            {
                FindObjectOfType <GameManager>().EndGame();
            }

            firstTicket = false;
        }
        else
        {
            Debug.Log(Orders.Count + "!!!!!!!!?????????!!!!!!");
            lastPos    = ticketList[ticketList.Count - 1].transform.position;
            newTickPos = lastPos + temp;
            GameObject newTicket = Instantiate(OrderPreFab, newTickPos, Quaternion.identity);
            newTicket.GetComponent <SpriteRenderer>().sprite = ProperDick[Orders[0]];
            ticketList.Add(newTicket);
            newTicket.GetComponent <IDscript>().ID = Orders[0];

            if (itemsPerTicket > 1)
            {
                firstItemPos  = ticketList[ticketList.Count - 1].transform.position;
                secondItemPos = firstItemPos + temp2;
                GameObject SecondItem = Instantiate(OrderPreFab, secondItemPos, Quaternion.identity);
                SecondItem.GetComponent <SpriteRenderer>().sprite = ProperDick2[Orders[1]];

                SecondItem.GetComponent <IDscript>().ID = Orders[1];
            }
            TicketKey = SammichHelper.MakeKey(Orders.Count, Orders);

            //  Debug.Log("BIG KEY HERE! : " + TicketKey);
            //CurrentTicket.BigKey = TicketKey;
            // CurrentTicket.theTicket = newTicket;
            //CurrentTicket.Debugstuff();
            Debug.Log(Orders.Count + "!!!!!!!!?????????!!!!!!");
        }
        if (ticketList.Count > LoseCon)
        {
            FindObjectOfType <GameManager>().EndGame();
        }
    }
Exemple #4
0
    /*public void SlideRail()
     * {
     *  ticketList.RemoveAll(x => x == null);
     *
     *  indexer = railPosition.IndexOf(ticketList.Last().GetComponent<Ticket>().item_pos);
     *  up = false;
     * }
     * /*
     *         int count = ticketList.Count;
     *  Vector3 moveUnits = new Vector3(-35, 0, 0);
     *  //float waitTime = 0.04f;
     *  // Vector3 buffer = Vector3.zero;
     *  for (int i = destroyedIndex; i < ticketList.Count; i++)
     *  {
     *      start = ticketList[i].transform.position;
     *      end = ticketList[i].transform.position + Vector3.left * moveDistance;
     *      Debug.Log("DESTROYED INDEX RIGHT HERE -------___-------------__------------>>>>>>>> " + destroyedIndex.ToString());
     *      currentLerpTime += Time.deltaTime;
     *      if (currentLerpTime > lerpTime)
     *      {
     *          currentLerpTime = lerpTime;
     *      }
     *      float perc = currentLerpTime / lerpTime;
     *      ticketList[i].transform.position = Vector3.Lerp(start, end, perc);
     *  }
     *  yield return new WaitForEndOfFrame();
     *  Debug.Log("INDEXER AT TEND OF SLIDERAIL()------------------------> " + indexer.ToString());
     *  Debug.Log("LAST ITEM VECTOR IN TICKET LIST =====================-> " + ticketList.Last().GetComponent<Ticket>().item_pos);if (!yield return new WaitForSeconds(waitTime);
     *      ticketList[i].transform.Translate( Vector3.left * 35 * speed * waitTime);
     *          ticketList[i].GetComponent<Ticket>().index--;[i].GetComponent<Ticket>().isFirst)
     *          buffer = new Vector3(-35f, -10f);
     *
     *      if (ticketList[i] != null)
     *      {
     *          while (Vector3.Distance(ticketList[i].transform.position, ticketList[i].transform.position + buffer ) > 0)
     *          {
     *              yield return new WaitForSeconds(waitTime);
     *              ticketList[i].transform.position = Vector3.MoveTowards(ticketList[i].transform.position, ticketList[i].transform.position + buffer, speed * waitTime);
     *
     *              if (Vector3.Distance(ticketList[i].transform.position, ticketList[i].transform.position + buffer) == 0)
     *                  break;
     *          }*/
    public void CreateOrder()
    {
        numTops        = Random.Range(1, 6);
        itemsPerTicket = Random.Range(1, 3);
        Orders         = SammichHelper.MakeOrder(numTops, itemsPerTicket);
        int DickLength1;
        int DickLength2;

        if (Orders.Count > 1)
        {
            DickLength1 = Orders[0].ToString().Length;
            DickLength2 = Orders[1].ToString().Length;
            ProperDick  = TheDicks[DickLength1];
            ProperDick2 = TheDicks[DickLength2];
        }
        else
        {
            DickLength1 = Orders[0].ToString().Length;
            ProperDick  = TheDicks[DickLength1];
        }
    }
Exemple #5
0
    /* Will update this as we push!
     * ---------------------------
     * Create order makes the key(s) for the item(s) on each ticket
     * Logic is as follows:
     * 1. Initialize numTops - The number of toppings that each sandwhich is comprised of via topping ID
     *    Initialize itemsPerTicket - Obviously it's the number of items per ticket. I'm going to write it so that we can have up to
     *    5 items per ticket, but for testing purposes we should  probably stick with 1-2 per.
     *
     * 2. Switch statement takes the case of numTops - The number of toppings determine the sandwhich that will be created.
     *    In each case, List <string> Orders is assigned the return value of MakeOrder (See SammichHelper.cs) - this is our list of items to
     *    display on the ticket.
     *    Then, ProperDick is assigned the value of the appropriate dictionary of Sprites ( See Sandwhiches.cs). Break out of Switch.
     *
     * 3. We then check to see if there is more than one item. If so , all we need to do is point to which dictionary each sprite in the List
     *    should use (assigned to ProperDick2). Note that we are NOT running MakeOrder again in the second Switch statement. All
     *    sammich keys in the list are generated in MakeOrder in the first Switch.
     *    THEN WE DONE HERE --> CreateOrder();
     */
    public void CreateOrder()
    {
        numTops        = Random.Range(0, 6);
        itemsPerTicket = Random.Range(0, 3);

        switch (numTops)
        {
        case 1:
            Orders     = (SammichHelper.MakeOrder(numTops, itemsPerTicket));
            ProperDick = Sandwiches.OneTopsDick;
            Debug.Log("TICKETS ORDER CHAOS :" + Orders[0]);
            break;

        case 2:
            Orders     = SammichHelper.MakeOrder(numTops, itemsPerTicket);
            ProperDick = Sandwiches.TwoTopsDick;
            SammichHelper.PrintAList("TICKETS ORDER @ CASE 2: ", Orders, -1);
            break;

        case 3:
            Orders     = SammichHelper.MakeOrder(numTops, itemsPerTicket);
            ProperDick = Sandwiches.ThreeTopsDick;
            SammichHelper.PrintAList("TICKETS ORDER @ CASE 3: ", Orders, -1);
            break;

        case 4:
            Orders     = SammichHelper.MakeOrder(numTops, itemsPerTicket);
            ProperDick = Sandwiches.FourTopsDick;
            SammichHelper.PrintAList("TICKETS ORDER @ CASE 4: ", Orders, -1);
            break;

        case 5:
            Orders     = SammichHelper.MakeOrder(numTops, itemsPerTicket);
            ProperDick = Sandwiches.FiveTopsDick;
            SammichHelper.PrintAList("TICKETS ORDER @ CASE 5: ", Orders, -1);
            break;

        default:
            break;
        }
        if (itemsPerTicket > 1)
        {
            for (int i = 1; i < Orders.Count; i++)
            {
                int x = Orders[i].Length;
                Debug.Log("ORDERS LENGTH PEOPLE: " + Orders[i].Length + " " + Orders[i]);

                switch (x)
                {
                case 1:
                    ProperDick2 = Sandwiches.OneTopsDick;
                    break;

                case 2:
                    ProperDick2 = Sandwiches.TwoTopsDick;
                    SammichHelper.PrintAList("TICKETS ITEM @ CASE 2 PT2: ", Orders, i);
                    break;

                case 3:
                    ProperDick2 = Sandwiches.ThreeTopsDick;
                    SammichHelper.PrintAList("TICKETS ITEM @ CASE 3 PT2: ", Orders, i);
                    break;

                case 4:
                    ProperDick2 = Sandwiches.FourTopsDick;
                    SammichHelper.PrintAList("TICKETS ITEM @ CASE 4 PT2: ", Orders, i);
                    break;

                case 5:
                    ProperDick2 = Sandwiches.FiveTopsDick;
                    SammichHelper.PrintAList("TICKETS ITEM @ CASE 5 PT2: ", Orders, i);
                    break;

                default:
                    break;
                }
            }
        }
    }