void Start() { usable = true; pickable = false; doorData = new DoorData { closedRotation = transform.rotation }; doorData.openRotation = doorData.closedRotation * Quaternion.Euler(Vector3.up * 90f); doorData.moving = false; var DOOR = record as DOORRecord; if (DOOR.FULL.Value != null) { doorData.doorName = DOOR.FULL.Value; } doorData.leadsToAnotherCell = refObjDataGroup.DNAM.Value != null || refObjDataGroup.DODT != null; doorData.leadsToInteriorCell = refObjDataGroup.DNAM.Value != null; if (doorData.leadsToInteriorCell) { doorData.doorExitName = refObjDataGroup.DNAM.Value; } if (doorData.leadsToAnotherCell && !doorData.leadsToInteriorCell) { var doorExitCell = BaseEngine.Instance.Data.FindCellRecord(BaseEngine.Instance.CellManager.GetCellId(doorData.doorExitPos, 0)); doorData.doorExitName = doorExitCell != null ? (((CELLRecord)doorExitCell).FULL.Value ?? "Unknown Region") : doorData.doorName; } if (refObjDataGroup.DODT != null) { doorData.doorExitPos = NifUtils.NifPointToUnityPoint(refObjDataGroup.DODT.Value.Position.ToVector3()); doorData.doorExitOrientation = NifUtils.NifEulerAnglesToUnityQuaternion(refObjDataGroup.DODT.Value.EulerAngles.ToVector3()); } objData.name = doorData.leadsToAnotherCell ? doorData.doorExitName : "Use " + doorData.doorName; }
void Start() { usable = true; pickable = false; doorData = new DoorData(); doorData.closedRotation = transform.rotation; doorData.openRotation = doorData.closedRotation * Quaternion.Euler(Vector3.up * 90f); doorData.moving = false; var DOOR = record as DOORRecord; if (DOOR.FNAM != null) { doorData.doorName = DOOR.FNAM.value; } doorData.leadsToAnotherCell = refObjDataGroup.DNAM != null || refObjDataGroup.DODT != null; doorData.leadsToInteriorCell = refObjDataGroup.DNAM != null; if (doorData.leadsToInteriorCell) { doorData.doorExitName = refObjDataGroup.DNAM.value; } if (doorData.leadsToAnotherCell && !doorData.leadsToInteriorCell) { var doorExitCell = TesEngine.instance._data.FindExteriorCellRecord(TesEngine.instance._cellManager.GetExteriorCellIndices(doorData.doorExitPos)); doorData.doorExitName = doorExitCell != null ? (doorExitCell.RGNN?.value ?? "Unknown Region") : doorData.doorName; } if (refObjDataGroup.DODT != null) { doorData.doorExitPos = NifUtils.NifPointToUnityPoint(refObjDataGroup.DODT.position); doorData.doorExitOrientation = NifUtils.NifEulerAnglesToUnityQuaternion(refObjDataGroup.DODT.eulerAngles); } objData.name = doorData.leadsToAnotherCell ? doorData.doorExitName : "Use " + doorData.doorName; }
private void GetAllDoors() { // THIS CODE IS KIND OF SHIT, BUT I AM NEW TO TILE MAPS AND I COULDN'T FIGURE OUT A BETTER WAY foreach (var pos in doorMap.cellBounds.allPositionsWithin) { Vector3Int localPlace = new Vector3Int(pos.x, pos.y, pos.z); if (doorMap.HasTile(localPlace)) { TileBase doorTile = doorMap.GetTile(localPlace); ButtonType buttonType; try{ buttonType = LookUpAssociation(doorTile); }catch (Exception e) { continue; } if (!DoorLookUp.ContainsKey(buttonType)) { DoorLookUp[buttonType] = new ButtonDoorData(); } DoorData doorData = new DoorData(); doorData.activated = null; doorData.deactivated = doorTile; doorData.location = localPlace; Vector3Int groundTileLoc = new Vector3Int(localPlace.x, localPlace.y, 0); doorData.groundTile = groundMap.GetTile(groundTileLoc); groundMap.SetTile(groundTileLoc, null); DoorLookUp[buttonType].doors.Add(doorData); } } }
public override void ChildTriggerEnter(GameObject o) { if (((GameLogic.Self != null) && (o == GameLogic.Self.gameObject)) && (this.state == DoorState.eNormal)) { DoorData.GotoDoor(this); } }
public Door(IRoom room, DoorData data) { Room = room; Data = data; Id = data.Id; Health = data.Health; }
public void SetData(CommonData.NOTE_LINE type) { Data = DataManager.Instance.DoorDataDic[PlayerData.Instance.GetUseSkin(CommonData.SKIN_TYPE.DOOR)]; NoteLineType = type; EffectPlay = false; DoorState = DOOR_STATE.NONE; SetDoorState(DOOR_STATE.CLOSE, false); }
void OnCollisionExit2D(Collision2D col) { if (col.gameObject.CompareTag("Door")) { DoorData door = col.gameObject.transform.parent.transform.parent.GetComponent <DoorData>(); currentCollidingDoors.Remove(door); EventsManager.Instance.playerUncollidesWithDoor.Invoke(playerControler, door, GetRemainingCollidingDoor()); } }
public BreakableDoor(float xPos, float yPos) : base(xPos, yPos) { MaxHits = 3; vertVbo = DoorData.GetVertexBufferID(); indVbo = DoorData.GetIndexBufferID(); indCount = DoorData.GetIndexCount(); tex = Resources.Textures["door.png"]; }
/// <summary> /// Загрузить данные о двери /// </summary> public override void SetData(InterObjData _intObjData) { DoorData dData = (DoorData)_intObjData; if (dData != null) { opened = dData.opened; } }
public Door(float xPos, float yPos) : base(xPos, yPos) { Dir = Direction.LEFT; vertVbo = DoorData.GetVertexBufferID(); indVbo = DoorData.GetIndexBufferID(); indCount = DoorData.GetIndexCount(); tex = Resources.Textures["door.png"]; }
/// <summary> /// Begin a scene transition by passing in the door that we are planning on loading from. /// This will return true if the scene transition began successfully /// </summary> /// <param name="PlayerCharacter"></param> /// <param name="DoorToLoad"></param> /// <returns></returns> public bool LoadNewRoomFromDoorActor(EHPlayerCharacter PlayerCharacter, DoorData DoorToLoad, bool bLoadLevelAsync = true) { if (bIsExecutingSceneTransition) { Debug.LogWarning("Scene Transition Is Currently In Progress"); return(false); } StartCoroutine(SceneTransitionCoroutine(PlayerCharacter, DoorToLoad)); return(true); }
private void PlayerHasUncollidedWithDoor(PlayerControler playerControler, DoorData doorThatUncollided, DoorData remainingCollidingDoor) { if (bubbleDictionnary.ContainsKey(playerControler.playerId)) { if (!remainingCollidingDoor) { CloseBubbleMessage(bubbleDictionnary[playerControler.playerId]); bubbleDictionnary.Remove(playerControler.playerId); } } }
/// <summary> /// Returns whether or not the door that is passed in is contained within our room /// </summary> /// <param name="Door"></param> /// <returns></returns> public bool DoesRoomContainDoor(DoorData Door) { foreach (DoorData RoomDoor in ConnnectedDoors) { if (RoomDoor == Door) { return(true); } } return(false); }
private GameObject GetDoor(DoorData data) { if (data.rotation == ElementRotation.UP || data.rotation == ElementRotation.DOWN) { return(door2x1HorizontalPrefab); } else { return(door2x1VerticalPrefab); } }
public DoorActor GetRoomDoorTriggerFromDoorData(DoorData Door) { foreach (DoorActor DoorActor in DoorTriggers) { if (DoorActor.GetAssociatedDoorData() == Door) { return(DoorActor); } } return(null); }
private void PlayerHasCollidedWithDoor(PlayerControler playerControler, DoorData door) { if (bubbleDictionnary.ContainsKey(playerControler.playerId)) { ChangeBubbleMessage(bubbleDictionnary[playerControler.playerId], InputsMap.Instance.interractWithDoor); } else { bubbleDictionnary.Add(playerControler.playerId, OpenBubbleMessage(playerControler, InputsMap.Instance.interractWithDoor)); } }
/// <summary> /// Загрузить данные о двери /// </summary> public virtual void SetData(InterObjData _intObjData) { DoorData dData = (DoorData)_intObjData; if (dData != null) { if (dData.opened) { Open(); } } }
/// <summary> /// /// </summary> /// <param name="application"></param> /// <param name="id"></param> /// <param name="status"></param> public void NotifyDoorChanged(string application, int id, bool status) { DoorData data = new DoorData(id, "", status); DoorData door = model.GetDoor(data.Id); door.Status = !data.Status; door.Image = LoadImage(door.Status ? "Open.png" : "Close.png"); model.AddLog(new LogData { AppName = application, Info = $"{door.Name} {(door.Status ? OPEN : CLOSE)}" }); }
void OnCollisionEnter2D(Collision2D col) { if (col.gameObject.CompareTag("Door")) { DoorData door = col.gameObject.transform.parent.transform.parent.GetComponent <DoorData>(); currentCollidingDoors.Add(door); EventsManager.Instance.playerCollidesWithDoor.Invoke(playerControler, door); } else if (col.gameObject.CompareTag("Explosive")) { col.gameObject.GetComponent <ExplosiveData>().Explode(); } }
public void SetTarget(int uniqueID) { target = GridData.GetExtensible(uniqueID); if (target != null) { targetUniqueID = target.uniqueID; } else { targetUniqueID = -1; return; } if (switchT == null) { return; } DoorData doorData = (DoorData)target.GetExtension(PStrings.door); if (doorData == null) { return; } if (doorData.key == DoorKey.Null) { offMaterial = Statics.green; onMaterial = Statics.greenLight; } else if (doorData.key == DoorKey.RedCard || doorData.key == DoorKey.RedSkull) { offMaterial = Statics.red; onMaterial = Statics.redLight; } else if (doorData.key == DoorKey.BlueCard || doorData.key == DoorKey.BlueSkull) { offMaterial = Statics.blue; onMaterial = Statics.blueLight; } else if (doorData.key == DoorKey.YellowCard || doorData.key == DoorKey.YellowSkull) { offMaterial = Statics.yellow; onMaterial = Statics.yellowLight; } }
private static DoorData GetDoorData(Door door, Vector3 position) { ElementRotation elementRotation; if (door.transform.rotation.eulerAngles.z == 90) { elementRotation = ElementRotation.RIGHT; } else { elementRotation = ElementRotation.UP; } DoorData data = new DoorData(ConvertVector3ToVector2Int(position), elementRotation); return(data); }
void ExportData(DoorData dd) { uint timestamp = Util.UnixTimestamp(); dd.modified = timestamp; string jsonResponse, errorMessage; Debug.Print( "{0}: set door {1} firerating to {2}", timestamp, dd._id, dd.firerating); HttpStatusCode sc = Util.Put( out jsonResponse, out errorMessage, "doors/" + dd._id, dd); //Util.Log( jsonResponse ); }
/// <summary> /// /// </summary> public async void GetDoors() { try { foreach (Door item in await client.GetDoorsStatusAsync()) { DoorData door = new DoorData(item.Id, item.Name, item.Status); door.Image = LoadImage(door.Status ? "Open.png" : "Close.png"); model.AddDoor(door); } } catch (Exception ex) { model.AddLog(new LogData { AppName = "ERROR", Info = $"Communication error: {ex}" }); } }
private void placeDoor(RoomDataHolder roomData, TileData tile, DoorData door, Orientation orientation, Coordinate coordinate) { GameObject doorObject = roomData.getRandomSpawnableDoor(); GameObject builtDoor = Instantiate(doorObject); Transform doorTransform = builtDoor.transform; if (doorTransform != null) { doorTransform.parent = this.gameObject.transform; Vector3 pos = getRealDoorPosition(coordinate, orientation); Vector3 rot = getRealDoorRotation(orientation); doorTransform.position = pos; doorTransform.eulerAngles = rot; } door.setDoorObject(builtDoor); }
static void Main() { BuildConfig(); BuildTestDataSets(); BuildDeviceClient(); Console.WriteLine("Data sets ready, select action:"); Console.WriteLine($"- 'PANI' = Transfer 'Panic'-data. (Max: {PanicData.Count()})"); Console.WriteLine($"- 'DOOR' = Transfer 'Door'-data. (Max: {DoorData.Count()})"); Console.WriteLine($"- 'FRID' = Transfer 'Fridge'-data. (Max: {FridgeData.Count()})"); Console.WriteLine($"- 'PLUG' = Transfer 'Smart Plug'-data. (Max: {PlugData.Count()})"); Console.WriteLine("- 'EXIT' = To exit console."); Console.WriteLine(""); do { Input = Console.ReadLine()?.ToUpper(); switch (Input) { case "PANI": Task.Run(async() => await TransferData(PanicData)); break; case "DOOR": Task.Run(async() => await TransferData(DoorData)); break; case "FRID": Task.Run(async() => await TransferData(FridgeData)); break; case "PLUG": Task.Run(async() => await TransferData(PlugData)); break; default: Console.WriteLine($"Input could not be processed."); Console.WriteLine($"Select a new keyword:"); break; } } while (Input != "EXIT"); }
public void SetDoorOpenTime(float value) { if (selectedObstacle == null) { return; } if (selectedObstacle.doorMode == DoorMode.Null) { return; } DoorData data = (DoorData)GetSelectedExtension(PStrings.door); if (data == null) { return; } data.openTime = value; }
public void SetDoorKey(int index) { if (selectedObstacle == null) { return; } if (selectedObstacle.doorMode == DoorMode.Null) { return; } DoorData data = (DoorData)GetSelectedExtension(PStrings.door); if (data == null) { return; } data.key = (DoorKey)index; }
public void SetDoorActivation(int index) { if (selectedObstacle == null) { return; } if (selectedObstacle.doorMode == DoorMode.Null) { return; } DoorData data = (DoorData)GetSelectedExtension(PStrings.door); if (data == null) { return; } data.activation = (DoorActivation)index; editorUI.doorSelectionUI.SetKeyPanelUsed(data); }
/*space bar 누를때 실행되는 함수 * 함수의 실행을 위해서는 object의 layer을 ispectObject로 바꿔주는 것 잊지 말기. */ public void Action(GameObject scanObj) { scanObject = scanObj; objData = scanObj.GetComponent <ObjectData>(); if (scanObj.tag == "Door") { DoorData doorScript = scanObject.GetComponent <DoorData>(); if (questManager.questId == 90 && doorScript.type != DoorData.DoorType.DoorAOut)//case 90에서는 문 안으로 들어가면 안됨. 잠겨있다는 말 띄워주기. room a에서 나갈떄만 문 열어주기. { /*말풍선이 있다면 띄워주기*/ talk(objData.id, objData.isNpc); talkPanel.SetActive(isAction); } else { /*공간 이동하기. (문을 통해 장소 이동)*/ isPlayerPause = true; StartCoroutine(door(scanObj)); } } else if (scanObj.tag == "Elevator") { Animator elevatorAnim = scanObj.GetComponent <Animator>(); elevatorAnim.SetTrigger("elevatorOn"); elevatorBGM.Play(); Invoke("elevator", 1.5f); } else if (scanObj.tag == "Floor Direction") { gameUIPanel.SetActive(false); FloorDirectionPanel.SetActive(true); } else { /*말풍선이 있다면 띄워주기*/ talk(objData.id, objData.isNpc); talkPanel.SetActive(isAction); } }
void Start() { usable = true; pickable = false; doorData = new DoorData(); doorData.closedRotation = transform.rotation; doorData.openRotation = doorData.closedRotation * Quaternion.Euler(Vector3.up * 90f); doorData.moving = false; var DOOR = record as DOORRecord; if (DOOR.FNAM != null) { doorData.doorName = DOOR.FNAM.value; } doorData.leadsToAnotherCell = (refObjDataGroup.DNAM != null) || (refObjDataGroup.DODT != null); doorData.leadsToInteriorCell = (refObjDataGroup.DNAM != null); if (doorData.leadsToInteriorCell) { doorData.doorExitName = refObjDataGroup.DNAM.value; } if (doorData.leadsToAnotherCell && !doorData.leadsToInteriorCell) { var doorExitCell = MorrowindEngine.instance.dataReader.FindExteriorCellRecord(MorrowindEngine.instance.GetExteriorCellIndices(doorData.doorExitPos)); doorData.doorExitName = (doorExitCell != null) ? doorExitCell.RGNN.value : doorData.doorName; } if (refObjDataGroup.DODT != null) { doorData.doorExitPos = Convert.NifPointToUnityPoint(refObjDataGroup.DODT.position); doorData.doorExitOrientation = Convert.NifEulerAnglesToUnityQuaternion(refObjDataGroup.DODT.eulerAngles); } objData.name = doorData.leadsToAnotherCell ? doorData.doorExitName : "Use " + doorData.doorName; }
/* public void createDoors(int iPosX, int iPosY, GameObject floorTile) { Vector3 scale = floorTile.transform.localScale; int maxDoors = Random.Range(1, 4); doors = new bool[4]; for(int i = 0; i < 4 ; i++) { doors[i] = false; } int index = -1; while(maxDoors != 0) { int i = Random.Range(1, width -2); int j = Random.Range(1, height - 2); bool iAxis = false; if(i >= j) { j = Random.Range(0, height ) > height / 2 ? height -1 : 0; if(j > height / 2) index = BOTTOM; else index = TOP; } else { i = Random.Range(0, width) > width / 2 ? width -1 : 0; iAxis = true; if(i > width / 2) index = RIGHT; else index = LEFT; } if(doors[index]) continue; int tileX = iPosX + i; int tileY = iPosY + j; int modX = iAxis ? 0 : 1; int modY = iAxis ? 1 : 0; wallList.Remove(tiles[i,j]); // wallList.Remove(tiles[i + modX ,j + modY]); replaceTile(floorTile, i, j, tileX, tileY); // replaceTile(floorTile, i + modX, j + modY, tileX + modX, tileY + modY); maxDoors--; } }*/ public void createDoorAtSide(int side, GameObject tile) { int i = 0; int j = 0; bool iAxis = false; switch(side) { case TOP: j = height -1; iAxis = true; break; case LEFT: i = 0; break; case BOTTOM: j = 0; iAxis = true; break; case RIGHT: i = width - 1; break; } if(iAxis) { i = Random.Range(3, width - 4); } else { j = Random.Range(3, height - 4); } int tileX = i + x; int tileY = j + y; /*int xOffset = 0; int yOffset = 0; if(iAxis) { xOffset = i + 1 < width - 1 ? 1 : -1; } else { yOffset = j + 1 < height - 1 ? 1 : -1; } */ DoorData d = new DoorData(); d.colRow = new Vector2(i, j); d.pos = new Vector2(tileX, tileY); /**DoorData d2 = new DoorData(); d2.colRow = new Vector2(i + xOffset, j + yOffset); d2.pos = new Vector2(tileX + xOffset, tileY + yOffset); */ DungeonBSP.doors.Add(d); // DungeonBSP.doors.Add(d2); d.side = side; doors.Add(d); /* d2.side = side; doors.Add(d2); */ // replaceTile(tile, i, j, tileX, tileY); // replaceTile(tile, i + xOffset, j + yOffset, tileX + xOffset, tileY + yOffset); /* if(xOffset < 0 || yOffset < 0) { replaceTile(tile, i + xOffset, j + yOffset, tileX + xOffset, tileY + yOffset); replaceTile(tile, i, j, tileX, tileY); } else { replaceTile(tile, i, j, tileX, tileY); replaceTile(tile, i + xOffset, j + yOffset, tileX + xOffset, tileY + yOffset); }*/ }
// ================================================================ // // 방을 만든다. // 방을 만든다. public RoomController createRoom(Map.RoomIndex room_index) { Vector3 room_center = Vector3.zero; Vector3 position = Vector3.zero; int n = 0; // ---------------------------------------------------------------- // // 방 관리 오브젝트를 만든다. RoomController room = this.get_room_root_go(room_index); room_center = this.getRoomCenterPosition(room_index); room.transform.position = room_center; // ---------------------------------------------------------------- // // 마루를 만든다. GameObject floors = new GameObject("floors"); floors.transform.position = room_center; room.floor_objects = new GameObject[this.block_grid_columns_num, this.block_grid_rows_num]; foreach(var bi in Map.BlockIndex.getRange(this.block_grid_columns_num, this.block_grid_rows_num)) { GameObject prefab = this.floor_prefabs[(bi.x + bi.z)%this.floor_prefabs.Length]; GameObject go = GameObject.Instantiate(prefab) as GameObject; position = this.getBlockCenterPosition(bi); position += room_center; go.transform.position = position; go.transform.parent = floors.transform; room.floor_objects[bi.x, bi.z] = go; } // ---------------------------------------------------------------- // // 방 이동 문을 만든다. List<DoorData> door_datas = new List<DoorData>(); // 플로어 우단 방이 아니면……. if(room_index.x < ROOM_COLUMNS_NUM - 1) { for(int bz = 0; bz < this.block_rows_num; bz++) { int bx = this.block_columns_num - 1; if (this.level_data[room_index.x, room_index.z][bx, bz] == FieldGenerator.ChipType.Door) { // 좌:우의 방을 연결하는 문. DoorData data = new DoorData(); data.type = DoorControl.TYPE.ROOM; data.room0 = room_index; data.room1 = room_index.get_next(1, 0); data.local_position = bz/2; door_datas.Add(data); } } } // 플로어 상단 방이 아니라면……. if(room_index.z < ROOM_ROWS_NUM - 1) { for(int bx = 0; bx < this.block_columns_num; bx++) { int bz = this.block_rows_num - 1; if (this.level_data[room_index.x, room_index.z][bx, bz] == FieldGenerator.ChipType.Door) { // 하:상의 방을 연결하는 문. DoorData data = new DoorData(); data.type = DoorControl.TYPE.ROOM; data.room0 = room_index; data.room1 = room_index.get_next(0, 1); data.local_position = bx/2; door_datas.Add(data); } } } this.create_doors(door_datas); // ---------------------------------------------------------------- // // 방 내벽을 만든다. List<InnerWallData> wall_datas = new List<InnerWallData>(); // 우벽 등록. for(int bz = 1;bz < this.block_rows_num;bz+=2) { for(int bx = 2;bx < this.block_columns_num - 2;bx+=2) { // 벽인지 조사한다. if(this.level_data[room_index.x, room_index.z][bx, bz] == FieldGenerator.ChipType.Wall) { InnerWallData data = new InnerWallData(); data.x = (bx - 2) / 2; data.z = (bz - 1) / 2; data.is_horizontal = false; // 세로 벽. wall_datas.Add(data); } } } // 상벽 등록. for(int bx = 1;bx < this.block_columns_num;bx+=2) { for(int bz = 2;bz < this.block_rows_num - 2;bz+=2) { // 벽인지 조사한다. if(this.level_data[room_index.x, room_index.z][bx, bz] == FieldGenerator.ChipType.Wall) { InnerWallData data = new InnerWallData(); data.x = (bx - 1) / 2; data.z = (bz - 2) / 2; data.is_horizontal = true; // 가로벽. wall_datas.Add(data); } } } this.create_inner_wall(room_index, wall_datas); // ---------------------------------------------------------------- // // 기둥을 만든다. // 벽이 두 장이상 접해 있는 부분에 만든다. List<PillarData> pillar_datas = new List<PillarData>(); PillarData pillar_data = new PillarData(); for(int x = 0;x < BLOCK_GRID_COLUMNS_NUM - 1;x++) { for(int z = 0;z < BLOCK_GRID_ROWS_NUM - 1;z++) { n = 0; // 좌. if(wall_datas.Exists(wall => (wall.is_horizontal && wall.x == x && wall.z == z))) { n++; } // 우. if(wall_datas.Exists(wall => (wall.is_horizontal && wall.x == x + 1 && wall.z == z))) { n++; } // 하. if(wall_datas.Exists(wall => (!wall.is_horizontal && wall.x == x && wall.z == z))) { n++; } // 상. if(wall_datas.Exists(wall => (!wall.is_horizontal && wall.x == x && wall.z == z + 1))) { n++; } if(n < 2) { continue; } pillar_data.x = x; pillar_data.z = z; pillar_datas.Add(pillar_data); } } this.create_pillar(room_index, pillar_datas); // ---------------------------------------------------------------- // floors.transform.parent = room.transform; return(room.GetComponent<RoomController>()); }