Наследование: MonoBehaviour
Пример #1
0
        public List <seat> GetSeats(seat objseat)
        {
            MySqlDatabaseFactory db         = new MySqlDatabaseFactory();
            Parameters           parameters = new Parameters();
            MySqlDataReader      reader     = null;
            MySqlConnection      conn       = db.GetDatabaseConnection();

            try
            {
                DataTable dt = new DataTable();
                parameters.Add("p_seatid", objseat.seatid, ParameterDirection.Input);
                parameters.Add("p_floorid", objseat.floorid, ParameterDirection.Input);
                parameters.Add("p_seatlabel", objseat.seatlabel, ParameterDirection.Input);
                parameters.Add("p_booked", objseat.isbooked, ParameterDirection.Input);
                using (reader = db.GetReader(conn, CommandType.StoredProcedure, Constants.StoredProcedures.ussp_seat, parameters))
                {
                    dt = db.Load(reader, true);
                }
                return(CommonUtility.ToList <seat>(dt));
            }
            catch (MySqlException odbcEx)
            {
                throw odbcEx;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { db.CloseConnection(conn); }
        }
Пример #2
0
//farbe, räder, sitze, marke

        public car(farbe colour, brand marke, seat sitz, int sitzAnzahl)
        {
            mColour = colour;
            mMarke  = marke;
            for (int i = 0; i < sitzAnzahl; i++)
            {
                mSeatArray[i] = sitz;
            }
            mSitzAnzahl = sitzAnzahl;
        }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        paused = gc.paused;
        if (!paused)
        {
            if (HasVirus)
            {
                transform.Find("person").Find("Cube").gameObject.GetComponent <MeshRenderer>().material      = human2;
                transform.Find("person").Find("Icosphere").gameObject.GetComponent <MeshRenderer>().material = human2;

                ps.gameObject.SetActive(true);
            }
            else
            {
                ps.gameObject.SetActive(false);
            }
            if (!foundloc)
            {
                int index = UnityEngine.Random.Range(0, seats.Length);
                if (!seats[index].claimed && !(seats[index] == chosenSeat))
                {
                    foundloc   = true;
                    chosenSeat = seats[index];

                    seats[index].claimed = true;
                    GetComponent <NavMeshAgent>().SetDestination(chosenSeat.gameObject.transform.position);
                    GetComponent <NavMeshAgent>().isStopped = false;
                }
            }
            // Debug.Log(GetComponent<NavMeshAgent>().remainingDistance);
            if ((transform.position - chosenSeat.gameObject.transform.position).magnitude < 3 && chosenSeat.claimed)
            {
                chosenSeat.claimed = false;
                GetComponent <NavMeshAgent>().isStopped = true;
                Debug.Log("Triggered 1");
                StartCoroutine("WaitAgain");
            }
            else if (foundloc && chosenSeat.claimed)
            {
                GetComponent <NavMeshAgent>().isStopped = false;
            }
        }
        else
        {
            GetComponent <NavMeshAgent>().isStopped = true;
        }
    }
Пример #4
0
    void OnTriggerEnter2D(Collider2D collider2d)
    {
        if (collider2d.tag == "Seat" && !leaving)
        {
            seat1 = collider2d.gameObject.GetComponent <seat>();
            if (!seat1.getBusy())
            {
                foundSeat = true;
//                mySeatFlag = 1;
                //print("setting seat to busy");
                seat1.setBusy();
            }
        }

        if (myOrder.Contains(collider2d.tag))
        {
            item      = collider2d;
            giveOrder = true;
        }
    }
Пример #5
0
        /*
         * pre - takes in an integer
         * post - returns a THand
         */
        // create a handArray from the TCards in the deckArray
        public THand dealHand(int mySeat)
        {
            seat  s = seat.NORTH; // default needed for some reason
            THand hand;           // THand handler??

            TCard[] handArray = new TCard[HANDSIZE];

            // determine the seat/position. North, South ,East or West
            switch (mySeat)
            {
            case 0:
                s = seat.NORTH;
                break;

            case 1:
                s = seat.EAST;
                break;

            case 2:
                s = seat.SOUTH;
                break;

            case 3:
                s = seat.SOUTH;
                break;
            }

            //int blah = (int)seat.North;  // just playing

            // create a new THand
            for (int i = 0; i < HANDSIZE; i++)
            {
                handArray[i] = deckArray[i + (mySeat * HANDSIZE)];
            }
            hand = new THand(handArray, s);
            return(hand);
        } // end dealhand method
 private Interfaces.ISeat ToSeat(seat seat)
 {
     return(new Seat(seat.seatId, seat.seatColumn, seat.seatNum, seat.seatRow, seat.seatType, seat.floorId, seat.seatIsactive));
 }
Пример #7
0
 // constructor
 public THand(TCard[] startHandArray, seat startSeat)
 {
     this.handArray = startHandArray;
     this.mySeat = startSeat;
 }
Пример #8
0
        private void day5_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < input.Count; i++)
            {
                Console.Out.WriteLine("====================");
                seat   temp = new seat();
                double rMin = 0, rMax = 128, cMin = 0, cMax = 7;
                double row = Math.Floor((rMax + rMin) / 2), column = Math.Round((cMax + cMin) / 2);
                Console.Out.WriteLine("0- min:" + cMin + " mid:" + column + " max:" + cMax);
                for (int j = 0; j < input[i].Length; j++)
                {
                    switch (input[i][j])
                    {
                    case 'F':
                        rMax = row;
                        row  = findMid(rMin, rMax, 1);
                        /*           Console.Out.WriteLine(input[i][j] + "- min:" + rMin + " mid:" + row + " max:" + rMax);*/
                        break;

                    case 'B':
                        rMin = row;
                        row  = findMid(rMin, rMax, 0);
                        /*  Console.Out.WriteLine(input[i][j] + "- min:" + rMin + " mid:" + row + " max:" + rMax);*/
                        break;

                    case 'R':
                        cMin = column;
                        if (j == 9)
                        {
                            column = cMax;
                        }
                        else
                        {
                            column = findMid(cMin, cMax, 1);
                        }
                        /*  Console.Out.WriteLine(input[i][j] + "- min:" + cMin + " mid:" + column + " max:" + cMax);*/
                        break;

                    case 'L':
                        cMax = column;
                        if (j == 9)
                        {
                            column = cMin;
                        }
                        else
                        {
                            column = findMid(cMin, cMax, 1);
                        }
                        /*     Console.Out.WriteLine(input[i][j] + "- min:" + cMin + " mid:" + column + " max:" + cMax);*/
                        break;
                    }
                }
                temp.row    = row;
                temp.column = 1 + column;
                temp.ID     = (row * 8) + column;
                seats.Add(temp.ID);
            }

            List <double> orderedSeats = seats.OrderBy(number => number).ToList();

            for (int i = 0; i < orderedSeats.Count; i++)
            {
                Console.Out.WriteLine(orderedSeats[i]);
            }
            double maxID = 0, myID = -1;

            for (int i = 0; i < orderedSeats.Count - 1; i++)
            {
                if (orderedSeats[i + 1] - orderedSeats[i] != 1)
                {
                    myID = orderedSeats[i] + 1;
                }
                if (orderedSeats[i] > maxID)
                {
                    maxID = orderedSeats[i];
                }
            }

            Console.Out.WriteLine("The highest ID is " + maxID + " and my seat is num " + myID);
        }
Пример #9
0
    void OnTriggerEnter2D(Collider2D collider2d)
    {
        if (collider2d.tag == "Seat" && !leaving)
        {
            seat1 = collider2d.gameObject.GetComponent<seat>();
            if (!seat1.getBusy())
            {
                foundSeat = true;
        //                mySeatFlag = 1;
                //print("setting seat to busy");
                seat1.setBusy();
            }
        }

        if (myOrder.Contains(collider2d.tag))
        {
            item = collider2d;
            giveOrder = true;
        }
    }
Пример #10
0
        private int hcp;                 // stores the High Card Point score

        // constructor
        public THand(TCard[] startHandArray, seat startSeat)
        {
            this.handArray = startHandArray;
            this.mySeat    = startSeat;
        }