Beispiel #1
1
    void UpdateTables()
    {
        int childCount = transform.childCount;

        //Empty all table chairs
        for (int c = 0; c < tableCount; c++)
        {
            Table t = tables[c];
            t.closeChairs.Clear();
        }

        //Fill all table chairs
        for (int i = 0; i < chairCount; i++)
        {
            Chair     c = chairs[i];
            Transform t = c.transform;

            float closest = Mathf.Infinity;
            int   xIndex  = 0;

            for (int x = 0; x < tableCount; x++)
            {
                float distance = (tables[x].table.transform.position - t.position).magnitude;
                if (distance < closest)
                {
                    closest = distance;
                    xIndex  = x;
                }
            }

            tables[xIndex].closeChairs.Add(c);
        }
    }
Beispiel #2
0
    //public int TimeToLookAgain;

    public void lookforConversation(Chair c)
    {
        LevelManager lvlmng = LevelManager.instance;

        currentStool = c;
        lvlmng.BM.WaitingList(this);
    }
        public Chair GetChair(string ID_Chair)
        {
            Chair chair = new Chair();

            try
            {
                string QueryString =
                    "select *" +
                    "from \"chair\"" +
                    "where \"ID_Chair\" = " + Convert.ToString(ID_Chair) + ";";
                NpgsqlCommand Command =
                    new NpgsqlCommand(QueryString, sqlConnection.CreateConnection.Connection);
                NpgsqlDataReader dataReader = Command.ExecuteReader();
                foreach (DbDataRecord dbDataRecord in dataReader)
                {
                    chair = new Chair(
                        dbDataRecord["ID_Chair"].ToString(),
                        dbDataRecord["c_name"].ToString(),
                        dbDataRecord["Phone"].ToString());
                }
                dataReader.Close();
            }
            catch (PostgresException ex)
            {
                MessageBox.Show("Ошибка базы данных \n" + Convert.ToString(ex));
            }
            return(chair);
        }
Beispiel #4
0
        public IChair CreateChair(string model, string materialType, decimal price, decimal height, int numberOfLegs)
        {
            // TODO: Implement this method
            IChair chair = new Chair(height, materialType, model, price, numberOfLegs);

            return(chair);
        }
        public async Task <Chair> Put(Chair updateChair)
        {
            _context.Update(updateChair);
            await _context.SaveChangesAsync();

            return(updateChair);
        }
        // Deletes the specified chair
        public bool DeleteChair(Chair chair)
        {
            Program            app                = Program.GetInstance();
            Database           database           = app.GetDatabase();
            ReservationService reservationService = Program.GetInstance().GetService <ReservationService>("reservations");

            // Find record
            ChairRecord record = database.chairs.SingleOrDefault(i => i.id == chair.id);

            if (record == null)
            {
                return(false);
            }

            // Remove record and related reservations
            database.chairs.Remove(record);

            foreach (Reservation reservation in reservationService.GetReservationsByChair(chair))
            {
                reservationService.DeleteReservation(reservation);
            }

            // Try to save
            database.TryToSave();

            return(true);
        }
Beispiel #7
0
        public override void OnShow()
        {
            base.OnShow();

            // Update labels
            title.Text         = show.GetMovie().name;
            imagePreview.Image = show.GetMovie().GetImage();

            // Update chair list
            container.Items.Clear();

            for (int i = 0; i < chairs.Count; i++)
            {
                Chair        chair = chairs[i];
                ListViewItem item  = new ListViewItem("Reserveer:  rij " + chair.row + " " + "nummer " + chair.number + "  prijs: €" + chair.price, i);

                item.Tag = chair;
                container.Items.Add(item);
            }

            // Disable save button if no chairs selected
            saveButton.Enabled = chairs.Count > 0;

            // Disable chair delete by default
            removeChairButton.Enabled = false;
        }
Beispiel #8
0
        private void cmdGuardar_Click(object sender, EventArgs e)
        {
            var numeroSilla    = this.txtNumeroSilla.Text;
            var ubicacionSilla = this.cmbUbicacion.SelectedValue.ToString();

            if (numeroSilla.Equals(string.Empty) || ubicacionSilla.Equals(string.Empty))
            {
                MessageBox.Show("Debe ingresar # silla y ubicación", Enumerations.GlobalInformation.CompanyName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            var silla = new Chair()
            {
                CodigoSilla = Convert.ToInt32(numeroSilla),
                Ubication   = Convert.ToChar(ubicacionSilla)
            };

            var insertCity = new ChairActions().InsertSilla((int)Enumerations.GlobalActions.Insertar, silla);

            if (!insertCity)
            {
                MessageBox.Show("Se generó error al almacenar", Enumerations.GlobalInformation.CompanyName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            MessageBox.Show("Ciudad almacenada con éxito", Enumerations.GlobalInformation.CompanyName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Beispiel #9
0
        private void DeleteButton_Click(object sender, EventArgs args)
        {
            Program      app          = Program.GetInstance();
            ChairService chairManager = app.GetService <ChairService>("chairs");

            // Find the chair
            Chair chair = chairManager.GetChairByRoomAndPosition(room, row, column);

            if (chair == null)
            {
                GuiHelper.ShowError("Er bestaat geen stoel op deze positie");
                return;
            }

            // Ask for confirmation
            if (!GuiHelper.ShowConfirm("Weet je zeker dat je deze stoel wilt verwijderen?"))
            {
                return;
            }

            // Delete it
            if (!chairManager.DeleteChair(chair))
            {
                GuiHelper.ShowError("Kon stoel niet verwijderen");
                return;
            }

            saveButton.Text      = "Stoel aanmaken";
            deleteButton.Enabled = false;
            GuiHelper.ShowInfo("Stoel succesvol verwijderd");
        }
Beispiel #10
0
        static void Main(string[] args)
        {
            Chair firstChair = new Chair();

            firstChair.Color    = "oranzova";
            firstChair.LegCount = 4;
            firstChair.Back     = Chair.BackType.Rounded;

            firstChair.PullChair();

            Console.WriteLine($"First chair is {firstChair.State}");

            Chair secondChair = new Chair();

            secondChair.Color    = "Light biege";
            secondChair.Back     = Chair.BackType.Rectangle;
            secondChair.LegCount = 4;

            // note 50 does not create an array of 50 chairs, it just prepares the list for 50 items
            List <Chair> allChairsInRoom = new List <Chair>(50);

            allChairsInRoom.Add(firstChair);
            allChairsInRoom.Add(secondChair);

            Table firstTable = new Table();

            firstTable.LegCount         = 6;
            firstTable.HasPrivacyShield = true;
            firstTable.Color            = "Dark Brown";

            foreach (Chair chair in allChairsInRoom)
            {
                Console.WriteLine($"Chair has color {chair.Color}, back is of type {chair.Back} and leg count is {chair.LegCount}");
            }
        }
Beispiel #11
0
        private void AddButton_Click(object sender, EventArgs args)
        {
            Program      app          = Program.GetInstance();
            ChairService chairManager = app.GetService <ChairService>("chairs");

            // Find or create chair
            Chair chair = chairManager.GetChairByRoomAndPosition(room, row, column);
            bool  isNew = false;

            if (chair == null)
            {
                chair = new Chair(room.id, row, column, 0, "default");
                isNew = true;
            }

            chair.price = (double)priceInput.Value;

            // Save chair
            if (!chairManager.SaveChair(chair))
            {
                GuiHelper.ShowError(ValidationHelper.GetErrorList(chair));
                return;
            }

            saveButton.Text      = "Stoel opslaan";
            deleteButton.Enabled = true;
            GuiHelper.ShowInfo("Stoel succesvol " + (isNew ? "aangemaakt" : "aangepast"));
        }
Beispiel #12
0
 public async Task <IActionResult> CreateChair([Bind("MovieTheaterNumber,AddressCompanyId,Row,Col")] Chair chair)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var movieTheater = new MovieTheater(await _context.MovieTheaters
                                                 .Include(m => m.Chairs)
                                                 .FirstOrDefaultAsync(m => (m.AddressCompanyId == chair.AddressCompanyId && m.MovieTheaterNumber == chair.MovieTheaterNumber)));
             movieTheater.AddChair(chair);
             _context.Add(chair);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateException e)
         {
             Debug.Write(e);
             TempData["erro"] = e.Message;
             return(RedirectToAction(nameof(CreateChair), new { chair.AddressCompanyId, chair.MovieTheaterNumber }));
         }
         catch (ArgumentException e)
         {
             Debug.Write(e);
             TempData["erro"] = e.Message;
             return(RedirectToAction(nameof(CreateChair), new { chair.AddressCompanyId, chair.MovieTheaterNumber }));
         }
         TempData["mensage"] = "Chair Create Success";
         return(RedirectToAction(nameof(Details), new { chair.AddressCompanyId, chair.MovieTheaterNumber }));
     }
     //ViewData["AddressCompanyId"] = new SelectList(_context.AddressCompanies, "Id", "Name", movieTheater.AddressCompanyId);
     return(View());
 }
        public ActionResult Create([Bind(Include = "Number,Name")] Chair chair)
        {
            // Проверка на уникальность номера
            if (db.Chairs.Where(a => a.Number == chair.Number).FirstOrDefault() != null)
            {
                // Фиксация ошибки
                ModelState.AddModelError("Number", "Такой номер уже есть в списке кафедр");
            }

            // Проверка на корректность данных
            if (ModelState.IsValid)
            {
                try
                {
                    chair.ID = Guid.NewGuid();
                    db.Chairs.Add(chair);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    // Дойти до самого внутреннего исключения
                    while (ex.InnerException != null)
                    {
                        ex = ex.InnerException;
                    }
                    ModelState.AddModelError("Number", ex.Message);
                }
            }

            // Повторный показ формы с ошибками
            return(View(chair));
        }
        private Teacher ToPOCO(Teacher teacher)
        {
            Chair teacherChair = null;

            if (teacher.Chair != null)
            {
                teacherChair           = new Chair();
                teacherChair.Id        = teacher.Chair.Id;
                teacherChair.Name      = teacher.Chair.Name;
                teacherChair.FacultyId = teacher.Chair.FacultyId;
                teacherChair.Faculty   = null;
                teacherChair.Teachers  = null;
            }

            List <Course> coursesList = null;

            if (teacher.Courses != null)
            {
                coursesList = teacher.Courses.Select((Course course) => new Course()
                {
                    Id       = course.Id,
                    Name     = course.Name,
                    Teachers = null
                }).ToList();
            }

            return(new Teacher()
            {
                Id = teacher.Id,
                FullName = teacher.FullName,
                ChairId = teacher.ChairId,
                Chair = teacherChair,
                Courses = coursesList
            });
        }
Beispiel #15
0
        /// <inheritdoc />
        public override void Draw(GameTime gameTime)
        {
            // Set the DiffuseColor to white to draw this Robot
            RobotEffect.DiffuseColor = Color.White.ToVector3();
            Robot.Draw(RobotWorld, Camera.View, Camera.Projection);

            // Set the DiffuseColor to red to draw this Robot
            RobotEffect.DiffuseColor = Color.Red.ToVector3();
            Robot.Draw(RobotTwoWorld, Camera.View, Camera.Projection);

            // Draw the Chair
            Chair.Draw(ChairWorld, Camera.View, Camera.Projection);

            // Draw the Tank
            Tank.Draw(TankWorld, Camera.View, Camera.Projection);



            // Draw bounding volumes

            Game.Gizmos.DrawCube(BoundingVolumesExtensions.GetCenter(RobotBox), BoundingVolumesExtensions.GetExtents(RobotBox) * 2f, Color.Yellow);

            Game.Gizmos.DrawCube(ChairOBBWorld, TouchingChair ? Color.Orange : Color.Green);

            Game.Gizmos.DrawSphere(_tankSphere.Center, _tankSphere.Radius * Vector3.One, TouchingTank ? Color.Orange : Color.Purple);

            Game.Gizmos.DrawCylinder(RobotTwoCylinder.Transform, TouchingOtherRobot ? Color.Orange : Color.White);


            base.Draw(gameTime);
        }
        public void PenaltyBoxTimersStop()
        {
            var chair1 = new Chair
            {
                StopWatch = new StopWatch {
                    Running = true, LastStarted = DateTime.Now - TimeSpan.FromSeconds(20)
                }
            };
            var chair2 = new Chair
            {
                StopWatch = new StopWatch {
                    Running = true, LastStarted = DateTime.Now - TimeSpan.FromSeconds(20)
                }
            };
            var chair3 = new Chair
            {
                StopWatch = new StopWatch {
                    Running = true, LastStarted = DateTime.Now - TimeSpan.FromSeconds(20)
                }
            };

            _state.PenaltyBox.Add(chair1);
            _state.PenaltyBox.Add(chair2);
            _state.PenaltyBox.Add(chair3);
            var response = _handler.Handle(_command);

            Assert.True(_state.PenaltyBox.TrueForAll(x => !x.StopWatch.Running));
            Assert.Equal(3, response.Events.Count(x => x.Event.GetType() == typeof(ChairUpdatedEvent)));
        }
        public IHttpActionResult PostChair(Chair chair)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if ((chair == null) || !FacultyExists(chair) || !TeachersExist(chair))
            {
                return(BadRequest());
            }

            AttachFaculty(chair);
            AttachTeachers(chair);

            try
            {
                db.Chairs.Add(chair);
                db.SaveChanges();
            }
            catch (Exception ex) when(ex is ArgumentNullException || ex is DbUpdateException)
            {
                return(BadRequest());
            }

            return(StatusCode(HttpStatusCode.Created));
        }
Beispiel #18
0
    // IEnumerator is needed in order to make a time pause - this is a coroutine
    IEnumerator makeBarberCutHairCoroutine()
    {
        // references
        Chair      barberChairScript   = barberChair.GetComponent <Chair>();
        GameObject customerCuttingHair = barberChairScript.customer.gameObject;

        //GameObject explosion = customerCuttingHair.GetComponent<CustomerController>().explosion;

        Debug.Log("barber is cutting some hair =)");

        customerCuttingHair.GetComponent <CustomerController>().served = true;
        yield return(new WaitForSeconds(cutHairDuration));          // a little pause

        //TODO: some animation would be nice though

        // freeing the barber chair
        barberChairScript.freeChair();

        customerCuttingHair.GetComponent <CustomerController>().leaving = true;
        if (Random.Range(0, 3) == 0)                                                   // chance of customer's death
        {
            customerCuttingHair.GetComponent <SpriteRenderer>().enabled = false;       //dont draw the skin of the customer
            Transform explosion = customerCuttingHair.transform.GetChild(0).transform; //enable explosion
            explosion.gameObject.SetActive(true);
        }
        Debug.Log("Hair cutted");
    }
        public IHttpActionResult PostChair(Chair chair)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if ((chair == null) || !FacultyExists(chair) || !TeachersExist(chair))
            {
                return(BadRequest());
            }

            AttachFaculty(chair);
            AttachTeachers(chair);

            try
            {
                db.Chairs.Add(chair);
                db.SaveChanges();
            }
            catch (Exception ex) when(ex is ArgumentNullException || ex is DbUpdateException)
            {
                return(BadRequest());
            }

            return(CreatedAtRoute("DefaultApi", new { id = chair.Id }, ToPOCO(chair)));
        }
Beispiel #20
0
 /// <summary>
 /// updates the info of the object, and it's surrounding tiles,
 /// and checks to make sure the position that the object is attempting to be placed at is valid
 /// </summary>
 /// <param name="obj">Object that is trying to be deleted</param>
 /// <param name="deleteNeighbors">deleteNeighbors, defaults to true and determines whether the Object's neighbors should be deleted</param>
 public static void DeleteObject(Chair obj, bool deleteNeighbors = true)
 {
     obj.isDeleted = true;
     foreach (Tile t in obj.tiles)
     {
         if (t.objs.Contains(obj) == true)
         {
             t.objs.Remove(obj);
         }
         if (obj.tiles.Contains(t) == true)
         {
             obj.tiles.Remove(t);
         }
     }
     obj.diffPos = new Vector3(0, 0, 0);
     if (obj.cbObjectChanged != null)
     {
         obj.cbObjectChanged(obj);
     }
     if (obj.connectsToNeighbors == true && Object.moveNeighbors == true && deleteNeighbors == true)
     {
         obj.DeleteNeighbors(obj);
     }
     obj.UpdateNeighbors(obj);
 }
        public async Task <Chair> Post(Chair newChair)
        {
            _context.Chair.Add(newChair);
            await _context.SaveChangesAsync();

            return(newChair);
        }
        public IChair CreateChair(string model, string materialType, decimal price, decimal height, int numberOfLegs)
        {
            MaterialType matType = GetMaterialType(materialType);
            Chair        chair   = new Chair(model, matType, price, height, numberOfLegs);

            return(chair);
        }
Beispiel #23
0
        public GameResponse <PlayerStats> RequestPlayerStats(Guid playerId, Chair chair)
        {
            if (chair == Chair.Standing)
            {
                return(GameResponse <PlayerStats> .Fail());
            }

            var player = _players.SingleOrDefault(p => p.Id == playerId);

            if (player == null)
            {
                return(GameResponse <PlayerStats> .Fail());
            }

            var playerForStats = _players.SingleOrDefault(p => p.Chair == chair);

            if (playerForStats == null)
            {
                return(GameResponse <PlayerStats> .Fail());
            }

            var playerStats = new PlayerStats(playerForStats);

            return(GameResponse <PlayerStats> .Pass(playerStats));
        }
        public IHttpActionResult PutChair(int id, Chair chair)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (chair == null)
            {
                return(BadRequest());
            }

            UpdateChair(chair, id);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ChairExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #25
0
        // should this just be random? Maybe make house rules?
        public GameResponse SetPlayerSeat(Guid playerId, Chair chair)
        {
            if (Phase != GamePhase.ChoosePlayers)
            {
                return(GameResponse.Fail());
            }

            var player = _players.SingleOrDefault(p => p.Id == playerId);

            if (player == null)
            {
                return(GameResponse.Fail());
            }
            if (player.Chair == chair)
            {
                return(GameResponse.Fail());
            }

            if (chair != Chair.Standing && _players.Any(p => p.Chair == chair))
            {
                return(GameResponse.Fail());
            }

            player.Chair = chair;

            return(GameResponse.Pass());
        }
Beispiel #26
0
        public ActionResult chairStatus(BookingModel model)
        {
            if (ModelState.IsValid)
            {
                ShowTimeDAO showTimeDAO = new ShowTimeDAO();
                ChairDAO    chairDAO    = new ChairDAO();
                UserDAO     userDAO     = new UserDAO();

                TicketBooking newtick = new TicketBooking();
                newtick.ShowTimesID = model.showTimeID;

                Chair chair = chairDAO.getChairIDByName(model.ChairName);
                newtick.ChairID = chair.ChairID;

                var userLogin = (UserLogin)Session[CommonConstants.USER_SESSION];
                newtick.UserID = userLogin.UserID;

                userDAO.Update(chair.Fare, userLogin.UserID);

                db.TicketBookings.Add(newtick);
                db.SaveChanges();

                return(RedirectToAction("InforUser", "User"));
            }

            return(View("Login"));
        }
Beispiel #27
0
    private void OnTriggerEnter(Collider other)
    {
        switch (other.tag)
        {
        case "SittingPoint":
            Chair ch = other.transform.parent.GetComponent <Chair>();
            if (ch.IsAvailable)
            {
                currentChair       = ch;
                agent.enabled      = false;
                transform.position = currentChair.PosB.position;
                //isOnStool = true;
                charactergb.isSitting = true;
                currentChair.Occupied(convsys);
                convsys.lookforConversation(currentChair);
                transform.LookAt(currentChair.DefaultPointToLook);
            }
            break;

        case "Exit":
            Debug.Log("BYE");
            foreach (ConvoSystem cs in convsys.partners)
            {
                cs.partners.Remove(convsys);
            }
            currentChair.IsAvailable = true;
            currentChair.PosA.GetComponent <SphereCollider>().enabled = true;
            Destroy(gameObject);
            break;
        }
    }
Beispiel #28
0
    private static void AnimateAndUpdatePlayerPosition(Chair firstChairInfo)
    {
        Vector3 finalDestination = singleton.positionBalcony.transform.position;

        finalDestination.y = firstChairInfo.playerSited.gameObject.transform.localPosition.y;
        firstChairInfo.playerSited.gameObject.transform.DOLocalMove(finalDestination, 0.4f);
    }
        public void ParseOffsets(ObjectInstance instance, Board board, int x, int y)
        {
            bool ladder = l0 == "ladder";

            if (footholdOffsets != null)
            {
                foreach (List <XNA.Point> anchorList in footholdOffsets)
                {
                    List <FootholdAnchor> anchors = new List <FootholdAnchor>();
                    foreach (XNA.Point foothold in anchorList)
                    {
                        FootholdAnchor anchor = new FootholdAnchor(board, x + foothold.X, y + foothold.Y, instance.LayerNumber, instance.PlatformNumber, true);
                        board.BoardItems.FHAnchors.Add(anchor);
                        instance.BindItem(anchor, foothold);
                        anchors.Add(anchor);
                    }
                    CreateFootholdsFromAnchorList(board, anchors);
                }
            }
            if (chairOffsets != null)
            {
                foreach (XNA.Point chairPos in chairOffsets)
                {
                    Chair chair = new Chair(board, x + chairPos.X, y + chairPos.Y);
                    board.BoardItems.Chairs.Add(chair);
                    instance.BindItem(chair, chairPos);
                }
            }
        }
        public static void SitDown(GameObject generalGameObject, NeedStatus restNeed)
        {
            Character2D character = generalGameObject.GetComponent <Character2D>();

            List <Chair> chairs = new List <Chair>(GameObject.FindObjectsOfType <Chair>()).Where(x => x.Occupied == false).ToList();

            if (chairs.Count <= 0)
            {
                return;
            }
            Chair chosenChair = chairs[_randomGenerator.Next(0, chairs.Count - 1)];

            chosenChair.Occupied = true;
            Vector2 chairPosition = chosenChair.transform.position;

            Stack <ITask> taskChain = new Stack <ITask>();

            taskChain.Push(new SitTask(new SitData
            {
                General  = character,
                Chair    = chosenChair,
                RestNeed = restNeed
            }));
            taskChain.Push(new PathfindToLocationTask(new PathfindData
            {
                Character = character,
                Location  = chairPosition
            }));

            character.Tasks.AddToStack(new AITaskChain(taskChain));
        }
Beispiel #31
0
	// Update is called once per frame
	void Update () {
    goals.ForEach(g=>g.updatePrerequisites(this));
    List<Goal> pendingGoals = goals.SkipWhile(g=>g.nextGoal(this) == null).ToList();
    if (pendingGoals.Any()) {
      Goal nextGoal = pendingGoals.First().nextGoal(this);

      Debug.Log(nextGoal);
      switch(nextGoal.GetType().ToString()) {
        case "GoalLocation":
          GoalLocation goalLocation = nextGoal as GoalLocation;

          if (goalIndicator != null) {
            goalIndicator.position = grid.positionForCoord(goalLocation.pos);
          }

          if (Time.time > pathLastUpdated + .5f) {
            PathFinder pathFinder = new PathFinder(manager,grid.navigable(),grid.coordForPosition(transform.position),goalLocation.pos);
            path = pathFinder.shortest();
            pathLastUpdated = Time.time;
          }
          if (path != null) {
            Vector3 direction = (grid.positionForCoord(path.First()) - transform.position).normalized;
            Quaternion newRotation = Quaternion.LookRotation(direction,Vector3.up);
            transform.rotation = Quaternion.Lerp(transform.rotation,newRotation,Time.deltaTime * 4f);

            transform.position = transform.position + direction * 3 * Time.deltaTime;
          }
        break;
        case "GoalSitInChair":
          GoalSitInChair goalSitInChair = nextGoal as GoalSitInChair;
          _currentChair = goalSitInChair.chair;
        break;
        case "GoalOrderCoffee":
          if ( Time.time < placedOrderAt ) {
            placedOrderAt = Time.time;
          }
          if ( Time.time > placedOrderAt + 3f) {
            hasOrdered = true;
          }
        break;
        case "GoalDrinkCoffee":
          if ( Time.time < startedDrinkingCoffeeAt ) {
            startedDrinkingCoffeeAt = Time.time;
          }
          if ( Time.time > startedDrinkingCoffeeAt + 5f) {
            hasDrunkCoffee = true;
          }
        break;
        case "GoalSitInNearestChair":
          GoalSitInNearestChair goalSitInNearestChair = nextGoal as GoalSitInNearestChair;
          _currentChair = goalSitInNearestChair.chair;
        break;
      }
    }
	}
 override public List<UpdatableGoal> populatePrerequisites(Person person) {
   _chair = closestChair(person);
   GoalLocation goal = new GoalLocation(person,_chair.grid.coordForPosition(_chair.transform.position));
   Action updateSelf = ()=>{
     Chair closest = closestChair(person);
     _chair = closest;
     goal.pos = _chair.grid.coordForPosition(_chair.transform.position);
   };
   return new List<UpdatableGoal>{
     new UpdatableGoal(goal,updateSelf)
   };
 }
Beispiel #33
0
 private void AddTakenChairsToQueue(Chair chair)
 {
     var playerInChair = _players.SingleOrDefault(p => p.Chair == chair);
     if (playerInChair != null)
         TurnOrder.AddToEnd(playerInChair);
 }
Beispiel #34
0
        // should this just be random? Maybe make house rules?
        public GameResponse SetPlayerSeat(Guid playerId, Chair chair)
        {
            if (Phase != GamePhase.ChoosePlayers)
                return GameResponse.Fail();

            var player = _players.SingleOrDefault(p => p.Id == playerId);
            if (player == null)
                return GameResponse.Fail();
            if (player.Chair == chair)
                return GameResponse.Fail();

            if (chair != Chair.Standing && _players.Any(p => p.Chair == chair))
                return GameResponse.Fail();

            player.Chair = chair;

            return GameResponse.Pass();
        }
Beispiel #35
0
 public bool isSittingOn(Chair chair) {
   return (_currentChair == chair);
 }
Beispiel #36
0
 public void SetCheiftan(Player player)
 {
     _cheiftanChair = player.Chair;
     while (player.Chair != Next().Chair)
         ;
 }
Beispiel #37
0
 public void NextCheiftan()
 {
     if (_cheiftanChair == Chair.Standing)
         return;
     SetCheiftanToCurrent();
     _cheiftanChair = Next().Chair;
 }
Beispiel #38
0
 public GoalSitInChair(Person person, Chair chair) {
   this._chair = chair;
   init(person);
 }
Beispiel #39
0
        public GameResponse<PlayerStats> RequestPlayerStats(Guid playerId, Chair chair)
        {
            if (chair == Chair.Standing)
                return GameResponse<PlayerStats>.Fail();

            var player = _players.SingleOrDefault(p => p.Id == playerId);
            if (player == null)
                return GameResponse<PlayerStats>.Fail();

            var playerForStats = _players.SingleOrDefault(p => p.Chair == chair);
            if (playerForStats == null)
                return GameResponse<PlayerStats>.Fail();

            var playerStats = new PlayerStats(playerForStats);
            return GameResponse<PlayerStats>.Pass(playerStats);
        }
 public override Product CreateProduct()
 {
     var chair = new Chair("A chair created by the chair creator");
     return chair;
 }