Exemplo n.º 1
0
        private void CheckRoom(Point room)
        {
            bool arrived = false;

            if (_direction == TravelDirection.Right)
            {
                if (Position.X > _building.GetRoomPosition(room).X)
                {
                    arrived = true;
                }
            }
            else if (_direction == TravelDirection.Left)
            {
                if (Position.X < _building.GetRoomPosition(room).X)
                {
                    arrived = true;
                }
            }


            if (arrived)
            {
                _isTraveling = false;
                IsAnimating  = false;
                Position.X   = _building.GetRoomPosition(room).X;
                RoomPosition = _building.GetRoomFromPosition(Position);

                if (IsExploring)
                {
                    IsExploring = false;

                    if (RandomHelper.RandomBool())
                    {
                        int x = RandomHelper.RandomInt(0, _building.Rooms - 1);
                        while (x == _building.ShaftPosition)
                        {
                            x = RandomHelper.RandomInt(0, _building.Rooms - 1);
                        }
                        RoomHeading = new Point(x, RoomHeading.Y);
                    }

                    if (!IsOnRightFloor)
                    {
                        InflictStress();
                    }
                }

                if (RoomPosition == RoomHeading)
                {
                    _hp += (int)(StressLevel * (_stressMultiplier / 2.0));
                    _textParticles.Add(new TextParticle(_game, "+" + ((int)StressLevel).ToString(), Color.Yellow, this));
                    _relievedSound.Play();
                    StressLevel = 0;
                    SetNewDestination();
                    VisitedFloors.Clear();
                }
            }
        }
Exemplo n.º 2
0
 public bool HasVisitedThisFloor(int floor)
 {
     return(VisitedFloors.Contains(floor));
 }