예제 #1
0
 // Start is called before the first frame update
 void Start()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
예제 #2
0
	protected void setStartVariables() {
		myTransform = transform;
		myRigidBody = GetComponent<Rigidbody>();
		roomController = transform.parent.GetComponent<RoomController> ();
		moveSpeed = GetComponent<EnemyStats>().moveSpeed;
		p1_Object = GameObject.Find ("P1");
		p2_Object = GameObject.Find ("P2");

		timer = Random.Range(1, 50);

		foreach (Transform child in transform) {
			if (child.name != "SpawnParticles" && child.tag != "Hitspark") {
				enemyAnimator = child.GetComponent<Animator> ();
			}
		}
		Vector3 predictedPlayerPos1 = p1_Object.transform.position + p1_Object.GetComponent<Rigidbody>().velocity * Time.deltaTime;
    	Vector3 predictedPlayerPos2 = p2_Object.transform.position + p2_Object.GetComponent<Rigidbody>().velocity * Time.deltaTime;
    	Transform p1_Transform = p1_Object.transform;
    	Transform p2_Transform = p2_Object.transform;
		// Predicted distance
    	float dist_1 = Vector3.Distance(myTransform.position, predictedPlayerPos1);
		float dist_2 = Vector3.Distance(myTransform.position, predictedPlayerPos2);
		if (dist_1 < dist_2) {
			targetPlayer = new TargetPlayer(GameObject.Find ("P1"), p1_Transform, dist_1);
		} else {
			targetPlayer = new TargetPlayer(GameObject.Find ("P2"), p2_Transform, dist_2);
		}
	}
예제 #3
0
 private void LoadRoomComboBox()
 {
     potencialRoomForMove = new ObservableCollection <Room>(RoomController.GetInstance().GetRooms());
     potencialRoomForMove.Remove(currentRoom);
     nextRoomComboBox.ItemsSource = null;
     nextRoomComboBox.ItemsSource = potencialRoomForMove;
 }
예제 #4
0
 public void CloseExternalDoors(HashSet <Tuple <int, int> > roomPositions)
 {
     foreach (GameObject room in rooms)
     {
         Tuple <int, int>         pos          = roomToOffset(room);
         RoomController           rC           = room.GetComponent <RoomController>();
         List <Tuple <int, int> > adjPositions = GetEmptyAdjacentRoomPositions(room, roomPositions);
         foreach (Tuple <int, int> adJpos in adjPositions)
         {
             if (adJpos.Item1 < pos.Item1)
             {
                 // open to the left
                 rC.DoorLeft.SetActive(true);
             }
             else if (adJpos.Item1 > pos.Item1)
             {
                 rC.DoorRight.SetActive(true);
             }
             else if (adJpos.Item2 < pos.Item2)
             {
                 rC.DoorBottom.SetActive(true);
             }
             else if (adJpos.Item2 > pos.Item2)
             {
                 rC.DoorTop.SetActive(true);
             }
         }
     }
 }
예제 #5
0
파일: RoomServer.cs 프로젝트: Fzcpp/MST
        /// <summary>
        /// Start registering our room server
        /// </summary>
        protected virtual void RegisterRoomServer()
        {
            Mst.Server.Rooms.RegisterRoom(roomOptions, (controller, error) =>
            {
                if (controller == null)
                {
                    logger.Error(error);

                    // Quit the room if we are not in editor
                    if (!Mst.Runtime.IsEditor)
                    {
                        Mst.Runtime.Quit();
                    }

                    return;
                }

                // Save our room controller
                RoomController = controller;

                OnRoomServerRegisteredEvent?.Invoke();

                logger.Info($"Room {controller.RoomId} is successfully registered with options {roomOptions}");
            });
        }
        private void AddSoba()
        {
            Soba novaSoba = new Soba();

            novaSoba.Sifra     = Convert.ToInt32(SifraTb.Text);
            novaSoba.Kapacitet = Convert.ToInt32(KapacitetTb.Text);
            novaSoba.Zauzetost = Convert.ToInt32(ZauzetostTb.Text);
            novaSoba.Tip       = (TypeOfUsage)TipCb.SelectedItem;
            novaSoba.Pocetak   = (DateTime)PocetakTb.SelectedDate;
            novaSoba.Kraj      = (DateTime)KrajTb.SelectedDate;
            Sobe.Add(novaSoba);
            RoomController             roomController             = new RoomController();
            RenovationPeriodController renovationPeriodController = new RenovationPeriodController();
            RenovationPeriod           p = new RenovationPeriod();
            Room room = new Room();

            room.Capacity   = novaSoba.Kapacitet;
            room.Number     = novaSoba.Sifra;
            room.Occupation = novaSoba.Zauzetost;
            room.Usage      = novaSoba.Tip;
            if (novaSoba.Pocetak != DateTime.Today && novaSoba.Kraj != DateTime.Today)
            {
                room.Renovation = true;
                p.room          = room;
                p.BeginDate     = novaSoba.Pocetak;
                p.EndDate       = novaSoba.Kraj;
                renovationPeriodController.ScheduleRenovation(p);
            }

            roomController.AddRoom(room);
            // Resetujemo polja
            ClearFields();

            UpdateTempSoba();
        }
예제 #7
0
        public void RoomDetails_ValidRoomIdProvided_ReturnNotNullViewResultModel()
        {
            // Arrange
            var mockUoW    = new Mock <IUnitOfWork>();
            var controller = new RoomController(mockUoW.Object);
            var roomId     = 1;

            var room1 = CreateRoomWithoutPlaceAndReservations();
            var room2 = CreateRoomWithoutPlaceAndReservations();

            room2.Id = 2;

            var listOfRooms = new List <Room>
            {
                room1,
                room2
            };

            mockUoW
            .Setup(x => x.RoomRepository.GetAll())
            .Returns(listOfRooms.AsQueryable());

            // Act
            ViewResult result = controller.Details(roomId) as ViewResult;

            // Assert
            Assert.IsNotNull(result.Model);
        }
예제 #8
0
    void DrawMap()
    {
        int count = 0;

        foreach (Room room in rooms)
        {
            if (room == null)
            {
                continue;
            }

            Vector3 drawPos = room.gridPos;

            drawPos.x *= 10;
            drawPos.y  = 0;
            drawPos.z *= 10;

            GameObject     settObject = Instantiate(roomWhiteObj, drawPos, Quaternion.identity);
            RoomController obj        = settObject.GetComponent <RoomController>();

            obj.doorTop   = room.doorTop;
            obj.doorBot   = room.doorBot;
            obj.doorRight = room.doorRight;
            obj.doorLeft  = room.doorLeft;

            if (count == 1)
            {
                Instantiate(Player, obj.PlayerSpawnPosition, false);
            }
            count++;
        }
    }
 private bool CheckInputControls()
 {
     if (idOfNewRoom == 0)
     {
         MessageBox.Show("Pogrešan unos šifre!", Constants.ERROR_MESSAGE_BOX_CAPTION, MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     else if (RoomController.GetInstance().RoomExists(idOfNewRoom))
     {
         MessageBox.Show("U sistemu postoji prostorija sa ovom šifrom!", Constants.ERROR_MESSAGE_BOX_CAPTION, MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     else if (string.Compare(nameOfNewRoom, "") == 0)
     {
         MessageBox.Show("Polje za unos naziva ne može biti prazno!", Constants.ERROR_MESSAGE_BOX_CAPTION, MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     else if (typeOfRoomComboBox.SelectedItem == null)
     {
         MessageBox.Show("Niste odabrali tip prostorije!", Constants.ERROR_MESSAGE_BOX_CAPTION, MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     else if (floorOfNewRoom == 0)
     {
         MessageBox.Show("Pogrešan unos sprata!", Constants.ERROR_MESSAGE_BOX_CAPTION, MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     return(true);
 }
예제 #10
0
    // 제네레이터를 찾는다.
    protected chrBehaviorEnemy_Lair         find_lair(string lair_name)
    {
        chrBehaviorEnemy_Lair lair = null;

        do
        {
            RoomController room_control = PartyControl.get().getCurrentRoom();

            Room room = this.rooms[room_control.getIndex().x, room_control.getIndex().z];

            var lairs = room.enemies.FindAll(x => ((x.behavior as chrBehaviorEnemy_Lair) != null));

            if (lairs.Count == 0)
            {
                break;
            }

            var lair_control = lairs.Find(x => (x.name == lair_name));

            if (lair_control == null)
            {
                break;
            }

            lair = lair_control.behavior as chrBehaviorEnemy_Lair;
        } while(false);

        return(lair);
    }
예제 #11
0
        public void Initialize()
        {
            var options = new DbContextOptionsBuilder <CoreDbContext>().UseInMemoryDatabase(databaseName: "RoomDatabase").Options;

            _testRooms   = new List <Room>();
            _testContext = new CoreDbContext(options);
            _testContext.Database.EnsureDeleted();

            for (var i = 0; i < 10; i++)
            {
                var newRoom = ModelFakes.RoomFake.Generate();
                _testContext.Add(newRoom);
                _testContext.SaveChanges();
                _testRooms.Add(ObjectExtensions.Copy(newRoom));
            }

            _nonActiveRooms        = ModelFakes.RoomFake.Generate();
            _nonActiveRooms.Active = false;
            _testContext.Add(_nonActiveRooms);
            _testContext.SaveChanges();
            _testRooms.Add(ObjectExtensions.Copy(_nonActiveRooms));

            _testRoomService    = new RoomService(_testContext);
            _testRoomController = new RoomController(_testRoomService);
        }
예제 #12
0
    void OpenWall(RoomController room, OpenConnection o)
    {
        switch (o.from)
        {
        case Direction.NORTH:
            room.NorthDoor.SetActive(true);
            o.room.SouthDoor.SetActive(true);
            room.NorthWall.SetActive(false);
            o.room.SouthWall.SetActive(false);
            break;

        case Direction.SOUTH:
            room.SouthDoor.SetActive(true);
            o.room.NorthDoor.SetActive(true);
            room.SouthWall.SetActive(false);
            o.room.NorthWall.SetActive(false);
            break;

        case Direction.EAST:
            room.WestWall.SetActive(false);
            o.room.EastWall.SetActive(false);
            break;

        case Direction.WEST:
            room.EastWall.SetActive(false);
            o.room.WestWall.SetActive(false);
            break;
        }
    }
        private void btnCheckOut_Click(object sender, RoutedEventArgs e)
        {
            object id_obj = ((Button)sender).CommandParameter;
            int    id;

            int.TryParse(id_obj.ToString(), out id);

            MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Check Out Confirmation", System.Windows.MessageBoxButton.YesNo);

            if (messageBoxResult == MessageBoxResult.Yes)
            {
                Reservation reservation = ReservationController.getInstance().find(id);
                if (reservation.Status == "Check in")
                {
                    FeedbackController.getInstance().openFeedback(id).Show();
                    Room room = RoomController.getInstance().find((int)reservation.RoomId);

                    ReservationController.getInstance().update(id, "Check out", room);
                    MessageBox.Show("Success check out");
                    load();
                }
                else
                {
                    MessageBox.Show("Cannot check out before check in!");
                }
            }
        }
예제 #14
0
 public OpenConnection(int x, int z, Direction from, RoomController room)
 {
     this.x    = x;
     this.z    = z;
     this.from = from;
     this.room = room;
 }
예제 #15
0
    // Method to check what area the player has entered and sets the CurrentArea to this new area
    private void SetNewArea(bool justLoaded = false)
    {
        int previousArea = currentArea;

        foreach (GameObject n in listAreaNodes)
        {
            RoomController room = n.GetComponent <RoomController> ();

            if (GetAreaRect(listAreaNodes.IndexOf(n)).Contains(followtarget))
            {
                previousArea = listAreaNodes.IndexOf(n);

                if (!justLoaded && previousArea == currentArea)
                {
                    return;
                }

                print("Current room: " + room.RoomName);

                currentArea = previousArea;
                room.EnteredRoom();
            }
            else
            {
                room.LeftRoom();
            }
        }
    }
        /// <summary>
        /// Start registering our room server
        /// </summary>
        protected virtual void RegisterRoomServer()
        {
            Msf.Server.Rooms.RegisterRoom(roomOptions, (controller, error) =>
            {
                if (controller == null)
                {
                    logger.Error(error);

                    // Quit the room if we are not in editor
                    if (!Msf.Runtime.IsEditor)
                    {
                        Msf.Runtime.Quit();
                    }

                    return;
                }

                // Save our room controller
                CurrentRoomController = controller;

                // Save room id to global options just for test purpose only
                Msf.Options.Set(MsfDictKeys.roomId, controller.RoomId);

                logger.Info($"Room {controller.RoomId} is successfully registered with options {roomOptions}");
            });
        }
예제 #17
0
    void Start()
    {
        roomController = GetComponent <RoomController>();
        GameObject parent = new GameObject();

        parent.name = "Rooms";
        GridArray   = new GameObject[Lenght, Height];
        int k = 0;

        for (int i = 0; i < Lenght; i += 2)
        {
            for (int j = 0; j < Height; j += 1)
            {
                k++;
                GridArray[i, j] = (GameObject)Instantiate(RoomSpace, new Vector3(i - (Lenght / 2), j - (Height / 2), 0), Quaternion.identity);
                GridArray[i, j].GetComponent <Rooms>().SetPopUp(popUpScreen);
                GridArray[i, j].GetComponent <Rooms>().SetRoomController(roomController);
                GridArray[i, j].GetComponent <Rooms>().SetID(k);
                GridArray[i, j].transform.SetParent(parent.transform);
                GridArray[i, j].name = "Room " + k;
                GridArray[i, j].tag  = "Room";
                roomController.GiveArray(GridArray[i, j]);
            }
        }

        //roomController.GiveArray(GridArray);
    }
예제 #18
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// LoadSettings loads the settings from the Database and displays them
        /// </summary>
        /// -----------------------------------------------------------------------------
        public override void LoadSettings()
        {
            try
            {
                if (Page.IsPostBack == false)
                {
                    //Check for existing settings and use those on this page
                    //Settings["SettingName"]

                    txtStartMessage.Text = Settings.Contains("StartMessage") ? Settings["StartMessage"].ToString() : Localization.GetString("DefaultStartMessage", "/DesktopModules/DnnChat/App_LocalResources/SharedResources.resx");

                    txtDefaultAvatarUrl.Text = Settings.Contains("DefaultAvatarUrl") ? Settings["DefaultAvatarUrl"].ToString() : Localization.GetString("DefaultAvatarUrl", "/DesktopModules/DnnChat/App_LocalResources/SharedResources.resx");

                    var rc = new RoomController();

                    ddlDefaultRoom.DataSource = rc.GetRooms(ModuleId);
                    ddlDefaultRoom.DataBind();

                    if (Settings.Contains("DefaultRoomId"))
                    {
                        ddlDefaultRoom.Items.FindByValue(Settings["DefaultRoomId"].ToString()).Selected = true;
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
예제 #19
0
        public void RoomCreatePost_ValidFormCollection_ReturnsRedirectToActionValidModel()
        {
            // Arrange
            var mockUoW            = new Mock <IUnitOfWork>();
            var mockRoomRepository = new Mock <IRepository <Room> >();
            var httpRequest        = new Mock <HttpRequest>();
            var httpContext        = new Mock <HttpContext>();
            var connection         = new Mock <ConnectionInfo>();
            var ipAddress          = IPAddress.Parse("127.0.0.1");

            httpContext.Setup(x => x.Request).Returns(httpRequest.Object);
            httpContext.Setup(x => x.Request.HttpContext).Returns(httpContext.Object);
            httpContext.Setup(x => x.Request.HttpContext.Connection).Returns(connection.Object);
            httpContext.Setup(x => x.Request.HttpContext.Connection.RemoteIpAddress).Returns(ipAddress);
            var controllerContext = new ControllerContext()
            {
                HttpContext = httpContext.Object,
            };

            var controller = new RoomController(mockUoW.Object)
            {
                ControllerContext = controllerContext
            };

            var fields         = new Dictionary <string, StringValues>();
            var formCollection = new FormCollection(fields);

            mockUoW.Setup(x => x.RoomRepository.Insert(It.IsAny <Room>()));

            // Act
            var result = controller.Create(formCollection) as RedirectToActionResult;

            // Assert
            Assert.AreEqual("Index", result.ActionName);
        }
 private void Reset(RoomController room)
 {
     Game.Init(null);
     if (room != null)
     {
         Prepare.DataContext = Current.Room = room;
         if (room.Room.Settings.Mode == GameMode.Multi)
         {
             PX1.Height    = new GridLength(32);
             Title         = "合作对战房间";
             p3.Visibility = Visibility.Collapsed;
         }
         else
         {
             PX1.Height    = new GridLength(0);
             Title         = "单打对战房间";
             p3.Visibility = Visibility.Visible;
         }
         Visibility = Visibility.Visible;
         ResetPrepare();
     }
     else
     {
         Current.Visibility = Visibility.Collapsed;
         br.Reset();
         Prepare.DataContext = null;
         Room = null;
     }
 }
예제 #21
0
    // 룸 안에 적을 만든다.
    public T                createRoomEnemy <T>(RoomController room, string name) where T : chrBehaviorEnemy
    {
        chrController chr   = null;
        T             enemy = null;

        do
        {
            string[] tokens     = name.Split('.');
            string   enemy_kind = name;

            if (tokens.Length > 1)
            {
                enemy_kind = tokens[0];
            }

            // 룸 안에 적을 만들 만들 수 있다(적의 수 제한 체크)?.
            if (!this.canCreateRoomEnemy(room))
            {
                break;
            }

            if ((chr = EnemyRoot.get().createEnemy(enemy_kind)) == null)
            {
                break;
            }

            if ((enemy = chr.behavior as T) == null)
            {
                break;
            }

            enemy.setRoom(room);

            Room level_room = this.rooms[room.getIndex().x, room.getIndex().z];

            if (GameRoot.get().isHost() && tokens.Length == 1)
            {
                enemy.name += "." + level_room.enemy_index.ToString("D3");
            }
            else
            {
                enemy.name = name;
            }
            level_room.enemies.Add(chr);

            dbwin.console().print("**EnemyName" + enemy.name);
            //Debug.Log("**EnemyName" + enemy.name);

            var as_lair = chr.behavior as chrBehaviorEnemy_Lair;

            if (as_lair != null)
            {
                level_room.lairs.Add(as_lair);
            }

            level_room.enemy_index++;
        } while(false);

        return(enemy);
    }
예제 #22
0
 internal void Init(RoomController userController)
 {
     if (userController != null)
     {
         var game = userController.Game;
         int observerTeamId;
         if (userController.PlayerController == null)
         {
             cp.Init(null);
             subtitle.Init(null);
             observerTeamId = 0;
         }
         else
         {
             var controlPanel = new ControlPanelVM(userController);
             cp.Init(controlPanel);
             subtitle.Init(controlPanel);
             observerTeamId = userController.PlayerController.Player.Team;
         }
         opms.DataContext = game.Board.Pokemons[observerTeamId];
         rpms.DataContext = game.Board.Pokemons[1 - observerTeamId];
         board.Init(game.Board, observerTeamId);
         Visibility = Visibility.Visible;
     }
     else
     {
         cp.Init(null);
         Visibility = Visibility.Collapsed;
     }
 }
예제 #23
0
    private void OnTriggerEnter2D(Collider2D collider)
    {
        if (collider.gameObject.name.Contains("Key"))
        {
            ui.foundKey();
            GameObject key = collider.gameObject;
            AddKey();
            Destroy(key);
        }

        KeyDoor keyDoor = collider.GetComponent <KeyDoor>();

        if (keyDoor != null)
        {
            roomController = GameObject.FindGameObjectWithTag("CurrentRoom").GetComponent <RoomController>();
            if (HasKey == true && (roomController.allDead == true || roomController.enemyCount == 0))
            {
                ui.useKey();
                RemoveKey();
                keyDoor.OpenDoor();
            }
            else
            {
                keyDoor.PlayOpenFailAnim();
            }
        }
    }
예제 #24
0
    void constructRoom(float x, float z, float width, float height, GameObject parent)
    {
        if (width < (2 * wallWidth) || height < (2 * wallWidth))
        {
            Debug.LogWarning("Warning: room should be large enough to accomodate wall size");
        }
        x = x - (width / 2);
        z = z + (height / 2);
        //top
        constructShape(x - (wallWidth / 2), z - (wallWidth / 2), x + width + (wallWidth / 2), z + (wallWidth / 2), 5.0f, parent);
        //bottom
        constructShape(x - (wallWidth / 2), z - height - (wallWidth / 2), x + width + (wallWidth / 2), z - height + (wallWidth / 2), 5.0f, parent);
        //left
        constructShape(x + width - (wallWidth / 2), z - height - (wallWidth / 2), x + width + (wallWidth / 2), z + (wallWidth / 2), 5.0f, parent);
        //right
        constructShape(x - (wallWidth / 2), z - height - (wallWidth / 2), x + (wallWidth / 2), z + (wallWidth / 2), 5.0f, parent);
        RoomController rc = parent.GetComponent <RoomController>();

        rc.x1     = x;
        rc.z1     = z;
        rc.x2     = x + width;
        rc.z2     = z - height;
        rc.width  = width;
        rc.height = height;
    }
예제 #25
0
 public static void DoHandle(RoomController room, int waveNumber)
 {
     Server.SendEvent(room.Clients, Utils.ToBytesJSON(new NetDataEvent(EventTypes.NewWave, new Dictionary <string, ObjectWrapper>()
     {
         { "wave_number", new ObjectWrapper <int>(waveNumber) }
     })), "EventWaveHandlerHandleNewWawe");
 }
예제 #26
0
        private void LoadController()
        {
            // HospitalManagementController
            doctorStatisticsController    = new DoctorStatisticsController(doctorStatisticsService);
            inventoryStatisticsController = new InventoryStatisticsController(inventoryStatisticsService);
            roomStatisticsController      = new RoomStatisticsController(roomStatisticsService);
            hospitalController            = new HospitalController(hospitalService);
            medicineController            = new MedicineController(medicineService);
            roomController      = new RoomController(roomService);
            inventoryController = new InventoryController(inventoryService);

            // MedicalController
            appointmentController = new AppointmentController(appointmentService, appointmentRecommendationService);
            diseaseController     = new DiseaseController(diseaseService);

            // MiscController
            articleController        = new ArticleController(articleService);
            doctorFeedbackController = new DoctorFeedBackController(doctorFeedbackService);
            feedbackController       = new FeedbackController(feedbackService);
            locationController       = new LocationController(locationService);
            messageController        = new MessageController(messageService);
            notificationController   = new NotificationController(notificationService);

            // UsersController
            doctorController    = new DoctorController(doctorService, diagnosisService, therapyService, medicalRecordService);
            managerController   = new ManagerController(managerService);
            patientController   = new PatientController(patientService, medicalRecordService, therapyService, diagnosisService);
            secretaryController = new SecretaryController(secretaryService);
            userController      = new UserController(userService);
        }
예제 #27
0
    protected void setStartVariables()
    {
        myTransform    = transform;
        myRigidBody    = GetComponent <Rigidbody>();
        roomController = transform.parent.GetComponent <RoomController> ();
        moveSpeed      = GetComponent <EnemyStats>().moveSpeed;
        p1_Object      = GameObject.Find("P1");
        p2_Object      = GameObject.Find("P2");

        timer = Random.Range(1, 50);

        foreach (Transform child in transform)
        {
            if (child.name != "SpawnParticles" && child.tag != "Hitspark")
            {
                enemyAnimator = child.GetComponent <Animator> ();
            }
        }
        Vector3   predictedPlayerPos1 = p1_Object.transform.position + p1_Object.GetComponent <Rigidbody>().velocity *Time.deltaTime;
        Vector3   predictedPlayerPos2 = p2_Object.transform.position + p2_Object.GetComponent <Rigidbody>().velocity *Time.deltaTime;
        Transform p1_Transform        = p1_Object.transform;
        Transform p2_Transform        = p2_Object.transform;
        // Predicted distance
        float dist_1 = Vector3.Distance(myTransform.position, predictedPlayerPos1);
        float dist_2 = Vector3.Distance(myTransform.position, predictedPlayerPos2);

        if (dist_1 < dist_2)
        {
            targetPlayer = new TargetPlayer(GameObject.Find("P1"), p1_Transform, dist_1);
        }
        else
        {
            targetPlayer = new TargetPlayer(GameObject.Find("P2"), p2_Transform, dist_2);
        }
    }
 private void reduceMagacineEquipmentQuantity()
 {
     foreach (DictionaryEntry de in roomEquipment)
     {
         RoomController.GetInstance().GetMagacine().EquipmentInRoom.ReduceEquipmentQuantity(de.Key.ToString(), (int)de.Value);
     }
 }
예제 #29
0
        public void RoomGetTest()
        {
            int id = 2;

            var room  = DataForTests.Rooms[id - 1];
            var toDTO = new MapperConfiguration(
                cfg =>
            {
                cfg.CreateMap <Room, RoomDTO>().ReverseMap();
                cfg.CreateMap <PriceCategory, PriceCategoryDTO>().ReverseMap();
                cfg.CreateMap <Category, CategoryDTO>().ReverseMap();
            }).CreateMapper();
            var roomDTO = toDTO.Map <Room, RoomDTO>(room);

            EFWorkUnitMock.Setup(x => x.Rooms.Get(id)).Returns(room);
            RoomServiceMock.Setup(a => a.Get(id)).Returns(roomDTO);

            var            roomService = new RoomService(EFWorkUnitMock.Object);
            RoomController controller  = new RoomController(RoomServiceMock.Object, ReservationServiceMock.Object);

            var       httpResponse = controller.Get(httpRequest, id);
            var       result       = httpResponse.Content.ReadAsAsync <RoomModel>();
            RoomModel expected     = mapper.Map <RoomDTO, RoomModel>(roomService.Get(id));

            Assert.AreEqual(expected, result.Result);
        }
예제 #30
0
 // Use this for initialization
 void Start()
 {
     roomController              = GetComponentInParent <RoomController>();
     specterData                 = FindObjectOfType <SpecterData>();
     startTime                   = Time.time;
     roomController.roomTension += specterData.darknessTension;
 }
예제 #31
0
        public void RoomCreateGet_TwoPlacesWithoutRoomsFound_ReturnViewResultModelWithTwoPlaces()
        {
            // Arrange
            var mockUoW    = new Mock <IUnitOfWork>();
            var controller = new RoomController(mockUoW.Object);

            var place1 = CreatePlaceWithoutRooms();
            var place2 = CreatePlaceWithoutRooms();

            var listOfPlaces = new List <Place>
            {
                place1,
                place2
            };

            mockUoW
            .Setup(x => x.PlaceRepository.GetAll())
            .Returns(listOfPlaces.AsQueryable());

            // Act
            ViewResult result  = controller.Create() as ViewResult;
            var        roomDto = result.Model as RoomDto;

            // Assert
            Assert.AreEqual(2, roomDto.Places.Count);
        }
예제 #32
0
	// Use this for initialization
	void Start () {
		nextRoom = GameObject.Find ("Room" + nextRoomNum);
		nextRoomPos = new Vector3(nextRoom.transform.position.x, nextRoom.transform.position.y, nextRoom.transform.position.z);
		roomController = transform.parent.GetComponent<RoomController> ();
		player1 = GameObject.Find ("P1");
		player2 = GameObject.Find ("P2");
		playersCamera = GameObject.Find ("CameraParentP1");
	}
    IEnumerator flicker(Light light, float[] steps, bool offAtTheEnd, RoomController room)
    {
        Transform currentRoom = _collector.currentRoom;
        float originalIntensity = light.intensity;
        int timeIndex = steps.Length / 2;
        for (int i = 0; i < timeIndex; i++)
        {
            light.intensity = steps[i];
            yield return new WaitForSeconds(steps[i + timeIndex]);
        }

        light.intensity = originalIntensity;
        if (offAtTheEnd)
            if (room != null && room.transform != currentRoom)
                light.enabled = false;
    }
예제 #34
0
	protected Character.BEAST_TYPE		request_summon_beast = Character.BEAST_TYPE.NONE;	// 소환수(디버그용).
	

	// ================================================================ //
	// MonoBehaviour에서 상속.

	void	Start()
	{

		if(dbwin.root().getWindow("party") == null) {

			this.create_debug_window();
		}

		// Network클래스의 컴포넌트 취득.
		GameObject obj = GameObject.Find("Network");
		
		if(obj != null) {
			m_network = obj.GetComponent<Network>();
			if (m_network != null) {
				m_network.RegisterReceiveNotification(PacketId.MovingRoom, OnReceiveMovingRoomPacket);
				// 소환수 관리는 PartyControl로 변경됨.
				// 그 때문에 소환수 출현 패킷 수신 함수는 CharacterRoot에서 PartyControl로 이동함.
				m_network.RegisterReceiveNotification(PacketId.Summon, OnReceiveSummonPacket);
			}
		}

		this.next_room = null;
	}
예제 #35
0
	// Use this for initialization
	void Start () {
		roomController = transform.parent.GetComponent<RoomController> ();
		switchName = transform.name;
		foreach (Transform child in transform) {
			if (child.CompareTag("Light")) {
				lightObject = child.GetComponent<Light> ();
			} else if (child.name == "Button") {
				buttonShader = child.GetComponent<Renderer>().material;
			}
		}

		animator = ButtonWire.GetComponent<Animator> ();

		basicColor = buttonShader.GetColor("_Color");
		emissionColor = buttonShader.GetColor("_EmissionColor");
		intensityDelta = lightObject.intensity / inverseShutoffSpeed;
		colorRDelta = basicColor.r / inverseShutoffSpeed;
		colorGDelta = basicColor.g / inverseShutoffSpeed;
		colorBDelta = basicColor.b / inverseShutoffSpeed;
		//colorADelta = basicColor.a / inverseShutoffSpeed;
		emissionColorRDelta = emissionColor.r / inverseShutoffSpeed;
		emissionColorGDelta = emissionColor.g / inverseShutoffSpeed;
		emissionColorBDelta = emissionColor.b / inverseShutoffSpeed;
	}
예제 #36
0
	// Use this for initialization
	void Start () {
		roomController = transform.parent.GetComponent<RoomController> ();
	}
예제 #37
0
        public CourseController(BlockController BlockContext, RoomController RoomContext, GroupController GroupContext, LecturerController LecturerContext)
            : base()
        {
            this.BlockContext = BlockContext;
            this.RoomContext = RoomContext;
            this.GroupContext = GroupContext;
            this.LecturerContext = LecturerContext;

            GroupList = GroupContext.GroupList;
            RoomPreferenceList = RoomContext.RoomList;
            LecturerList = LecturerContext.LecturersList;

            Repetitions = new Dictionary<Course, int>();

            CourseList = new ObservableCollection<Course>();
        }
예제 #38
0
	// '다음 방' 설정.
	public void		setNextRoom(RoomController room)
	{
		this.next_room = room;
	}
예제 #39
0
	// ================================================================ //

	// '지금 있는 방' 설정.
	public void		setCurrentRoom(RoomController room)
	{
		this.current_room = room;
		this.next_room    = room;

		MapCreator.get().SetCurrentRoom(this.current_room);
	}
예제 #40
0
 public void New()
 {
     _currentConfigFilepath = "";
     TimetableData ttData = new TimetableData();
     BlockContext = new BlockController();
     RoomContext = new RoomController();
     LecturerContext = new LecturerController();
     GroupContext = new GroupController();
     CourseContext = new CourseController(BlockContext, RoomContext, GroupContext, LecturerContext);
 }
예제 #41
0
        public void Load()
        {
            OpenFileDialog fileDialog = new OpenFileDialog();
            fileDialog.Filter = "xml-Files (*.xml)|*.xml";
            fileDialog.InitialDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
            fileDialog.ShowDialog();

            TimetableData t = new TimetableData();
            TimetableData ttData = TimetableConfigIO.ImportTimetableConfig(fileDialog.FileName);
            if (ttData == null)
            {
                MessageBox.Show("Data could not be loaded.", "Loading error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            BlockContext = new BlockController();
            foreach (var block in ttData.Blocks)
            {
                BlockContext.BlockList.Add(block);
            }
            if (ttData.Blocks.Length > 0)
                BlockContext.SelectedIndex = 0;

            RoomContext = new RoomController();
            foreach (var room in ttData.Rooms)
            {
                RoomContext.RoomList.Add(room);
            }
            if (ttData.Rooms.Length > 0)
                RoomContext.SelectedIndex = 0;

            GroupContext = new GroupController();
            foreach (var group in ttData.Groups)
            {
                GroupContext.GroupList.Add(group);
            }
            if (ttData.Groups.Length > 0)
                GroupContext.SelectedIndex = 0;

            LecturerContext = new LecturerController();
            foreach (var lecturer in ttData.Lecturers)
            {
                LecturerContext.LecturersList.Add(lecturer);
            }
            if (ttData.Lecturers.Length > 0)
                LecturerContext.SelectedIndex = 0;

            CourseContext = new CourseController(BlockContext, RoomContext, GroupContext, LecturerContext);
            AddCourses(CourseContext, ttData.Courses);
            if (ttData.Courses.Length > 0)
                CourseContext.SelectedIndex = 0;
        }
예제 #42
0
	//======================================================================
	//
	// 외부에서 호출되는 메소드.
	//

	// 적과 방을 연결합니다.	
	public void SetRoom(RoomController a_room)
	{
		this.room = a_room;
	}
예제 #43
0
파일: ItemWindow.cs 프로젝트: fotoco/006772
	// ================================================================ //

	// 룸 이동 후에 호출되고 싶다.
	public void		onRoomChanged(RoomController room)
	{
		// 열쇠 아이콘을 대응하는 도어 방향으로 표시한다.

		if(room != null) {

			Map.EWSN[]		key_dir = new Map.EWSN[4];
	
			for(int i = 0;i < 4;i++) {
	
				key_dir[i] = Map.EWSN.NONE;
			}
			for(int i = 0;i < (int)Map.EWSN.NUM;i++) {
	
				DoorControl	door = room.getDoor((Map.EWSN)i);
	
				if(door == null) {
	
					continue;
				}
	
				int	key_type = door.KeyType;

				if(key_type >= 4) {

					continue;
				}
				key_dir[key_type] = (Map.EWSN)i;
			}
	
			Vector2		base_pos = BASE_POS;
			Vector2		pos;
	
			base_pos.x += KEY_ICON_SIZE.x;
			base_pos.y += KEY_ICON_SIZE.y;

			for(int i = 0;i < 4;i++) {
	
				pos = base_pos - WINDOW_SIZE/2.0f;

				this.sprite_key[i].setVisible(true);

				// 도어가 없을 때는 비표시로.
				if(key_dir[i] == Map.EWSN.NONE) {
	
					this.sprite_key[i].setVisible(false);
					continue;
				}

				// 언락되지 않음 = 열쇠를 아직 줍지 않았으면 비표시.
				DoorControl	door = room.getDoor(key_dir[i]);

				if(!door.IsUnlocked()) {

					this.sprite_key[i].setVisible(false);
				}

				//

				float	offset = KEY_ICON_SIZE.x*0.6f;

				switch(key_dir[i]) {

					case Map.EWSN.NORTH:	pos += new Vector2(0.0f,  offset);	break;
					case Map.EWSN.SOUTH:	pos += new Vector2(0.0f, -offset);	break;
					case Map.EWSN.EAST:		pos += new Vector2( offset, 0.0f);	break;
					case Map.EWSN.WEST:		pos += new Vector2(-offset, 0.0f);	break;
				}
				this.sprite_key[i].setPosition(pos);
			}

		}
	}
예제 #44
0
	// 생성된 룸을 설정한다.
	public void		setRoom(RoomController room)
	{
		this.room = room;
	}
예제 #45
0
	// Use this for initialization
	void Start () {
		instance = this;
		floorNumber = 0;
	}
예제 #46
0
파일: MapCreator.cs 프로젝트: fotoco/006772
	// ================================================================ //
	// 방 관련.

	public void SetCurrentRoom(RoomController newCurrentRoom)
	{
		//Debug.Log ("Party " + currentRoom + " ---> " + newCurrentRoom);
		if (currentRoom != null) {
			currentRoom.NotifyPartyLeave();
		}
		currentRoom = newCurrentRoom;
		currentRoom.NotifyPartyEnter();
	}