示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.L))
        {
            FindObjectOfType <GameUIDisplay>().Score += 5;
        }

        if (Input.GetKeyDown(KeyCode.T))
        {
            onboard.SetBubbleActive(1, true);
        }

        if (Input.GetKeyDown(KeyCode.Y))
        {
            onboard.SetBubbleActive(1, false);
        }
    }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        if (scoreboard.Score <= 0)
        {
            SceneManager.LoadScene("GameOver");
        }

        //Setting the bubbles based on their booleans
        onboard.SetBubbleActive(0, welcome);
        onboard.SetBubbleActive(1, click);
        onboard.SetBubbleActive(3, table);
        onboard.SetBubbleActive(4, tableMove);

        //Only run the game loop if not paused
        if (!pauseMenu.Paused)
        {
            //If statement that will allow the table bubble to only display once
            if (onboard.TableInstruct && table2)
            {
                table  = true;
                table2 = false;
            }

            //Start a timer to turn off the tableMove bubble if it is active
            if (tableMove)
            {
                timeLeft2 -= Time.deltaTime;

                if (timeLeft2 <= 0.0f)
                {
                    tableMove  = false;
                    tableMove2 = false;
                }
            }

            //Decrease timer which starts at 5
            timeLeft -= Time.deltaTime;

            //Turn off the welcome bubble and turn on click
            if (timeLeft <= 0.0f && welcome)
            {
                welcome = false;
                click   = true;
            }

            //Don't allow player to select a patron while the welcome message is playing
            if (!welcome)
            {
                if (Input.GetKeyDown(KeyCode.Space) && inProgress == false)
                {
                    customerRef = quequeRef.Pop();
                    pos         = customerRef.transform.position;

                    customerRef.ActivePlaying = true;
                    shift      = true;
                    inProgress = true;
                    if (click)
                    {
                        onboard.MoveInstruct = true; //Set move instruct to true, will use this to turn on the move instructions from customer script
                    }
                    //Turning off click when the first patron is selected
                    click = false;

                    //Debug.Log(inProgress);
                }
            }

            /* Lucas Code
             * if (Vector3.Distance(pos, customerRef.transform.position) > 2.0f && shift)
             * {
             *  quequeRef.ShiftQueque();
             *  shift = false;
             * }
             *
             * if (Vector3.Distance(customerRef.transform.position, target.transform.position) <= 2.75f)
             * {
             *  customerRef.ActivePlaying = false;
             *  inProgress = false;
             * }
             */

            //**BELOW TAKEN OUT AND PUT INTO METHOD UNDERNEATH UPDATE**
            // Carson Code
            // Temp switches on Left Arrow Press

            /*if (Input.GetKeyDown(KeyCode.P))
             * {
             *  //Debug.Log("C " + customerRef.transform.position);
             *  for(int i = 0; i < gridref.Targets.Length; i++)
             *  {
             *      //Debug.Log("G " + gridref.Targets[i]);
             *      if (
             *          customerRef.transform.position.x <= gridref.Targets[i].x + 0.05 &&
             *          customerRef.transform.position.x >= gridref.Targets[i].x - 0.05 &&
             *          customerRef.transform.position.y <= gridref.Targets[i].y + 0.05 &&
             *          customerRef.transform.position.y >= gridref.Targets[i].y - 0.05)
             *      {
             *          //Debug.Log("HIT");
             *          quequeRef.ShiftQueque();
             *          // + 50 per seat
             *          scoreboard.Score += 50;
             *          scoreboard.PatronsSat++;
             *          scoreboard.PatronsLeft--;
             *          shift = false;
             *          customerRef.ActivePlaying = false;
             *          inProgress = false;
             *          if (tableMove2)
             *              tableMove = true;
             *          table = false;
             *          soundEffect.PlayOneShot(chair);
             *          return;
             *      }
             *  }
             *
             * }*/

            //if(Input.GetKeyDown(KeyCode.J))
            //{
            //    CustomerCollision();
            //}
        }
    }
示例#3
0
    // Update is called once per frame
    void Update()
    {
        //Set this x and y to its moveable object script x and y
        if (!isSeated)
        {
            this.GetComponent <MoveableObject>().xPosition = curX;
            this.GetComponent <MoveableObject>().yPosition = 9 - curY;
        }



        //Display the move instructions
        onboard.SetBubbleActive(2, onboard.MoveInstruct);

        if (!pauseMenu.Paused)
        {
            pos = this.transform.position;
            //If the current customer activate the movement
            if (activePlaying)
            {
                // Carson Code
                // Update what keys are pressed and released
                press();
                depress();
                placed = true;
            }
            // Carson Code
            // Sit once no longer active and have moved
            else if (placed)
            {
                animator.SetBool("Walk", false);
                animator.SetBool("Sit", true);
            }
        }

        if (inSeat)
        {
            if (!isSeated)
            {
                if (Input.GetKeyDown(KeyCode.E))
                {
                    //Set the xPos and yPos in moveable object so their positions are lined up
                    this.GetComponent <MoveableObject>().xPosition = curX;
                    this.GetComponent <MoveableObject>().yPosition = 9 - curY;

                    isSeated = true;
                    //Grab the number of the collider
                    string snumToAssociate = seat.gameObject.name.Remove(0, 13); //Trim the rest of the name so you just have the number (number assigned in TableScript)
                    int    numToAssociate  = int.Parse(snumToAssociate);
                    for (int i = 0; i < numberOfTables; i++)
                    //For each table in the list, check their number. Become an associated object when the numbers match.
                    {
                        //Pull the number of the table
                        int tableNum = moveableManager.GetComponent <MoveableManager>().tables[i].GetComponent <TableScript>().tableNumber;
                        //Check if the number is the same as the associated
                        if (numToAssociate == tableNum)
                        {
                            //If they are, add this customer to the table's moveable object list.
                            moveableManager.GetComponent <MoveableManager>().tables[i].GetComponent <MoveableObject>().associatedObjects.Add(this.GetComponent <MoveableObject>());

                            //Disable selection + movement for this customer
                            //This seems to happen already!
                        }
                    }

                    //call the code in Level Manager that makes them sit down
                    levelManager.CustomerCollision();
                }
            }
        }
    }