void Update() { int viewSize; if (player == null) { player = GameObject.FindGameObjectWithTag("Player");//.GetComponent<PlayerCountroller>(); playerController = player.GetComponent <PlayerController>(); playerTransform = player.transform; } if (playerController.attatchTo != null) { playerTransform = playerController.attatchTo.transform; viewSize = playerController.attatchTo.GetComponent <PlayerController>().viewSize; } else { playerTransform = player.transform; viewSize = playerController.viewSize; } //阴影效果 Vector3Int avatarPositionInGrid = tileUtility.getAvatarPosInTilemap(playerTransform.position); tileUtility.hideInvisibleTiles(shadeTilemap, hideTile, avatarPositionInGrid, config, viewSize); }
private void OnTriggerExit2D(Collider2D collider) { if (tag == "servant" && collider.tag == "doorTile" && playerController.attatchTo != gameObject && tileUtility.getAvatarPosInTilemap(transform.position) != RoomPos) { Debug.Log("close door"); var doorTileMap = collider.gameObject.GetComponent <Tilemap>(); if (doorTileMap.GetTile(RoomPos) == passTile_verti) { if (tileUtility.changeToReplaceTile(doorTileMap, RoomPos, unpassTile_verti)) { collider.gameObject.GetComponent <CompositeCollider2D>().isTrigger = false; } } if (doorTileMap.GetTile(RoomPos) == passTile_hori) { if (tileUtility.changeToReplaceTile(doorTileMap, RoomPos, unpassTile_hori)) { collider.gameObject.GetComponent <CompositeCollider2D>().isTrigger = false; } } } }
public void storyFlow() { if (tileUtility.getAvatarPosInTilemap(player.transform.position) == storyPosList[0]) { //hideAvatar("servant"); //hideAvatar("fighter"); storyImg.sprite = storyImgList[0]; //storyImg.color = new Color(255, 255, 255, 10); //showStory(false); } else if (tileUtility.getAvatarPosInTilemap(player.transform.position) == storyPosList[1]) { showAvatar("servant"); hideAvatar("fighter"); storyImg.sprite = storyImgList[1]; //storyImg.color = new Color(255, 255, 255, 100); //showStory(false); } else { storyImg.color = new Color(255, 255, 255, 0); //showStory(true); showAvatar("servant"); showAvatar("fighter"); } /* * //故事2触发 * if (tileUtility.getAvatarPosInTilemap(playerPos) == storyPosList[1]) * { * storyImg.sprite = storyImgList[1]; * } * //故事1触发 * if (tileUtility.getAvatarPosInTilemap(playerPos) == storyPosList[2]) * { * storyImg.sprite = storyImgList[2]; * } * //故事1触发 * if (tileUtility.getAvatarPosInTilemap(playerPos) == storyPosList[3]) * { * storyImg.sprite = storyImgList[3]; * } * //故事1触发 * if (tileUtility.getAvatarPosInTilemap(playerPos) == storyPosList[4]) * { * storyImg.sprite = storyImgList[4]; * } * //故事1触发 * if (tileUtility.getAvatarPosInTilemap(playerPos) == storyPosList[5]) * { * storyImg.sprite = storyImgList[5]; * } * //故事1触发 * if (tileUtility.getAvatarPosInTilemap(playerPos) == storyPosList[6]) * { * storyImg.sprite = storyImgList[6]; * } * //故事1触发 * if (tileUtility.getAvatarPosInTilemap(playerPos) == storyPosList[7]) * { * storyImg.sprite = storyImgList[7]; * } */ }