public void RemoveTrapComponent(TrapComponent trapComponent) { if (trapDictionaryByOrigin.ContainsKey(trapComponent.origin.x)) { trapDictionaryByOrigin[trapComponent.origin.x].Remove(trapComponent.origin.y); } }
public void PushpadAction(ChampionComponent champion, Node currentNode, Node beforeNode) { animator.SetTrigger("invoke"); Node targetNode = currentNode; if (direction == Direction.up) { targetNode += new Node(0, 1); } else if (direction == Direction.right) { targetNode += new Node(1, 0); } else if (direction == Direction.down) { targetNode += new Node(0, -1); } else if (direction == Direction.left) { targetNode += new Node(-1, 0); } TrapComponent trapComponent = pm.pathManager.GetTrapComponent(targetNode); if (trapComponent == null || !trapComponent.isObstacle) { champion.MoveChampion(currentNode, targetNode, GameManager.championMoveDuration, MoveType.walk, false); } else { champion.MoveChampion(currentNode, beforeNode, GameManager.championMoveDuration, MoveType.walk, false); } }
public void PutTrapComponent(TrapComponent trapComponent) { if (!trapDictionaryByOrigin.ContainsKey(trapComponent.origin.x)) { trapDictionaryByOrigin.Add(trapComponent.origin.x, new Dictionary <int, TrapComponent>()); } trapDictionaryByOrigin[trapComponent.origin.x].Add(trapComponent.origin.y, trapComponent); }
public void PunchmachineAttack() { // Debug.Log("PunchmachineAttack()"); Node targetNode = origin; Node knockBackNode = origin; // TODO: knockBackNode에 설 수 있는지 확인해야 함. //그 자리에 obstacle이 있다면 걍 제자리에서 데미지만 받아야 함. if (this.direction == Direction.up) { targetNode += new Node(0, 1); knockBackNode += new Node(0, 2); } else if (this.direction == Direction.right) { targetNode += new Node(1, 0); knockBackNode += new Node(2, 0); } else if (this.direction == Direction.down) { targetNode += new Node(0, -1); knockBackNode += new Node(0, -2); } else if (this.direction == Direction.left) { targetNode += new Node(-1, 0); knockBackNode += new Node(-2, 0); } // Debug.Log("pm.player.origin: " + pm.player.origin.ToString()); // Debug.Log("targetNode: " + targetNode.ToString()); if (pm.champion.origin == targetNode) { // Debug.Log("punch!!!"); // Debug.Log(gameObject.name); TrapComponent trapComponent = pm.pathManager.GetTrapComponent(knockBackNode); if (trapComponent == null || !trapComponent.isObstacle) { pm.champion.TakeDamage(attack, DamageType.trap); pm.champion.MoveChampion(targetNode, knockBackNode, GameManager.championMoveDuration, MoveType.knockback, false); //밀쳐내기 //기존에 이동중이라면 이동과 관련된 코루틴을 정지시키고 //목적지만 파라미터로 받는(출발지는 현재 플레이어의 위치) //이동 함수를 사용하여 밀어낸다 } } }
//TODO:특수스킬이나 아이템 사용과 같은 입력이 들어올 수 있으 public void PlayerAction(PlayerInput input) { // if (!isHpDecreasing) // { // isHpDecreasing = true; // hpDecreasingCoroutine = StartCoroutine(DecreasingPlayerHp()); // } if (isClear) { return; } if (playSceneState == PlaySceneState.main || playSceneState == PlaySceneState.gameover || playSceneState == PlaySceneState.pause) { return; } if (playSceneState == PlaySceneState.ready) { playSceneState = PlaySceneState.play; } if (!isSpIncreasing) { isSpIncreasing = true; spIncreasingCoroutine = StartCoroutine(IncreasingPlayerSp()); } //플레이어의 방향과 서있는 블럭의 타잎에 따라 다음에 가야할 노드와 회전유무가 정해진다. if (input == PlayerInput.left || input == PlayerInput.right || input == PlayerInput.forward) { if (champion.isDead) { // Debug.Log("player is dead"); return; } if (champion.isMoving) { Debug.Log("champion is moving. so skip action"); return; } if (champion.isAttacking) { return; } Node targetNode = champion.origin; Node nextNode = GetNextNode(champion, input); BlockComponent blockComponent = pathManager.GetBlockComponentByOrigin(champion.origin); BlockComponent nextBlockComponent = pathManager.GetBlockComponentByOrigin(nextNode); //null 일 수도있다 Direction targetDirection = champion.direction; if (champion.isWatered) { champion.isWatered = false; champion.MoveChampion(champion.origin, champion.origin, GameManager.championMoveDuration, MoveType.walk, false); return; } else if (champion.isBitten) { champion.isBitten = false; champion.MoveChampion(champion.origin, champion.origin, GameManager.championMoveDuration, MoveType.walk, false); return; } //스트레이트 블럭 위에 있고 입력받은곳에 적이 있는지 확인해야한다 //공격후 적이 죽는다면 적이 있던 자리로 이동하고 적이 죽지 않으면 원래 있던 자리로 돌아와야 한다 // Debug.Log("player.origin: " + player.origin.ToString()); TrapComponent trapComponent = pathManager.GetTrapComponent(nextNode); if (trapComponent != null && trapComponent.isObstacle) { champion.MoveChampion(champion.origin, champion.origin, GameManager.championMoveDuration, MoveType.walk, false); return; } if (IsEnemyInDirection(nextNode)) { champion.Attack(champion.origin, nextNode, GameManager.championMoveDuration); return; } else { targetDirection = champion.direction; if (champion.direction == Direction.right) { if (input == PlayerInput.left) { targetNode += new Node(1, 1); } else if (input == PlayerInput.right) { targetNode += new Node(1, -1); } else if (input == PlayerInput.forward) { targetNode += new Node(1, 0); } } else if (champion.direction == Direction.up) { if (input == PlayerInput.left) { targetNode += new Node(-1, 1); } else if (input == PlayerInput.right) { targetNode += new Node(1, 1); } else if (input == PlayerInput.forward) { targetNode += new Node(0, 1); } } else if (champion.direction == Direction.down) { if (input == PlayerInput.left) { targetNode += new Node(1, -1); } else if (input == PlayerInput.right) { targetNode += new Node(-1, -1); } else if (input == PlayerInput.forward) { targetNode += new Node(0, -1); } } if (nextBlockComponent != null && (nextBlockComponent.blockData.blockCategory == BlockCategory.turn || nextBlockComponent.blockData.blockCategory == BlockCategory.shortcut_end)) { targetDirection = nextBlockComponent.blockData.direction; } } bool isRotate = champion.direction != targetDirection; champion.MoveChampion(champion.origin, targetNode, GameManager.championMoveDuration, MoveType.walk , isRotate); if (isRotate) { champion.RotateChampion(champion.direction, targetDirection, GameManager.championMoveDuration); } } else { //이동이외의 입력이 들어온다면 여기서 구현해야 한다 } }
public void InitSectionComponent(SectionModel sectionData, SectionModel nextSectionData, SectionComponent lastSectionComponent, bool isLastSection = false) { // Debug.Log("SectionComponent.InitSectionComponent(" + sectionData.sectionId.ToString() + ")"); isCollapsing = false; blockComponents.Clear(); this.sectionData = sectionData; SetSectionPosition(this.sectionData.origin); // Debug.Log("pm.pathManager.sectionList.Count: " + pm.pathManager.sectionList.Count.ToString()); // if (lastSectionComponent != null) { Debug.Log("lastSectionComponent: " + lastSectionComponent); } // else { Debug.Log("lastSectionComponent is null"); } int baseProgress = lastSectionComponent != null ? lastSectionComponent.maxProgress : 0; minProgress = baseProgress; int _maxProgress = -1; // Debug.Log("sectionData.height: " + sectionData.height.ToString()); // Debug.Log("sectionData.width: " + sectionData.width.ToString()); for (int i = 0; i < this.sectionData.height; i++) { for (int j = 0; j < this.sectionData.width; j++) { TerrainGid terrainGid = TerrainGid.empty; if (sectionData.terrains != null) { terrainGid = (TerrainGid)sectionData.terrains[i, j]; } else { //terrain정보가 들어오지 않는 경우는 코너섹션일 때 terrainGid = TerrainGid.basic_dirt; } if (terrainGid == TerrainGid.empty) { continue; } GameObject blockPrefab = PrefabManager.Instance.GetBlockPrefab(terrainGid); GameObject blockGameObject = Instantiate(blockPrefab) as GameObject; // GameObject blockGameObject = ObjectPool.Spawn(blockPrefab); blockGameObject.name = "block#" + pm.pathManager.lastBlockComponentId.ToString(); blockGameObject.transform.SetParent(blockContainer); BlockComponent blockComponent = blockGameObject.GetComponent <BlockComponent>(); BlockCategory blockCategory = this.sectionData.sectionType == SectionType.corner ? BlockCategory.corner : BlockCategory.straight; if (this.sectionData.sectionType == SectionType.corner) { SectionComponent _beforeSectionComponent = pm.pathManager.GetSectionComponent(this.sectionData.sectionId - 1); // SectionComponent _beforeBeforeSectionComponent = pm.pathManager.GetSectionComponent(this.sectionData.sectionId - 2); if (_beforeSectionComponent == null) //first corner section { blockCategory = BlockCategory.corner; } else if (this.sectionData.direction == Direction.up || (this.sectionData.direction == Direction.right && (_beforeSectionComponent.sectionData.direction == Direction.up))) { if (i + j >= 2 && !(i == 2 && j == 2)) { blockCategory = BlockCategory.turn; } else { blockCategory = BlockCategory.corner; } } else if (this.sectionData.direction == Direction.down || (this.sectionData.direction == Direction.right && (_beforeSectionComponent.sectionData.direction == Direction.down))) { if (j >= i && !(i == 0 && j == 2)) { blockCategory = BlockCategory.turn; } else { blockCategory = BlockCategory.corner; } } if (isLastSection) { blockCategory = BlockCategory.straight; } } else if (this.sectionData.sectionType == SectionType.straight) { if (this.sectionData.direction == Direction.up) { if (j == this.sectionData.width - 1 && i == this.sectionData.height - 1) { blockCategory = BlockCategory.shortcut_start; } else if (j == 0 && i == 0) { blockCategory = BlockCategory.shortcut_end; } else { blockCategory = BlockCategory.straight; } } else if (this.sectionData.direction == Direction.down) { if (j == this.sectionData.width - 1 && i == 0) { blockCategory = BlockCategory.shortcut_start; } else if (j == 0 && i == this.sectionData.height - 1) { blockCategory = BlockCategory.shortcut_end; } else { blockCategory = BlockCategory.straight; } } else if (this.sectionData.direction == Direction.right) { SectionComponent _beforeSectionComponent = pm.pathManager.GetSectionComponent(this.sectionData.sectionId - 1); SectionComponent _beforeBeforeSectionComponent = pm.pathManager.GetSectionComponent(this.sectionData.sectionId - 2); if ((nextSectionData.direction == Direction.up) && (j == this.sectionData.width - 1 && i == this.sectionData.height - 1)) { blockCategory = BlockCategory.shortcut_start; } else if ((nextSectionData.direction == Direction.down) && (j == this.sectionData.width - 1 && i == 0)) { blockCategory = BlockCategory.shortcut_start; } else if (_beforeBeforeSectionComponent != null) { if (_beforeBeforeSectionComponent.sectionData.direction == Direction.up && (j == 0 && i == 0)) { blockCategory = BlockCategory.shortcut_end; } else if (_beforeBeforeSectionComponent.sectionData.direction == Direction.down && (j == 0 && i == this.sectionData.height - 1)) { blockCategory = BlockCategory.shortcut_end; } else { blockCategory = BlockCategory.straight; } } else { blockCategory = BlockCategory.straight; } } //다음 코너에서 방향이 어떨게 되냐에따라 현재 스트레이트 섹션의 숏컷이 결정된다 /* * * if ((this.sectionData.direction == Direction.right && nextSectionData.direction == Direction.up) || * (this.sectionData.direction == Direction.up && nextSectionData.direction == Direction.right)) * { * if (j == this.sectionData.width - 1 && i == this.sectionData.height - 1) * { * blockCategory = BlockCategory.shortcut_start; * } * else if (this.sectionData.direction == Direction.right && j == this.sectionData.width - 1) * { * blockCategory = BlockCategory.straight_edge; * } * else if (this.sectionData.direction == Direction.up && i == this.sectionData.height - 1) * { * blockCategory = BlockCategory.straight_edge; * } * else if (j == 0 && i == 0) * { * Debug.Log("???"); * blockCategory = BlockCategory.shortcut_end; * } * else * { * blockCategory = BlockCategory.straight; * } * } * else * { * if (j == this.sectionData.width - 1 && i == 0) * { * blockCategory = BlockCategory.shortcut_start; * } * else if (this.sectionData.direction == Direction.right && j == this.sectionData.width - 1) * { * blockCategory = BlockCategory.straight_edge; * } * else if (this.sectionData.direction == Direction.down && i == 0) * { * blockCategory = BlockCategory.straight_edge; * } * else if (j == 0 && i == this.sectionData.height - 1) * { * Debug.Log("!!!"); * blockCategory = BlockCategory.shortcut_end; * } * else * { * blockCategory = BlockCategory.straight; * } * } */ } int progress = 0; if (sectionData.sectionType == SectionType.straight) { if (sectionData.direction == Direction.right) { progress = baseProgress + j + 1; } else if (sectionData.direction == Direction.up) { progress = baseProgress + i + 1; } else if (sectionData.direction == Direction.down) { progress = baseProgress + (this.sectionData.height - i); } } else if (sectionData.sectionType == SectionType.corner) { progress = baseProgress + 1; } if (progress > _maxProgress) { _maxProgress = progress; } BlockModel blockData = new BlockModel( pm.pathManager.lastBlockComponentId++, blockCategory, this.sectionData.direction, this.sectionData.origin + new Node(j, i), progress); blockComponent.InitBlockComponent(this, blockData); blockComponents.Add(blockComponent); pm.pathManager.PutBlockComponent(blockComponent); } } if (sectionData.objects != null) { // Debug.Log("---------"); // Debug.Log(sectionData.objects.Count); // Debug.Log("sectionData.direction: " + sectionData.direction); // Debug.Log("sectionData.width: " + sectionData.width.ToString()); // Debug.Log("sectionData.height: " + sectionData.height.ToString()); foreach (KeyValuePair <Node, TiledObject> kv in sectionData.objects) { Node node = kv.Key; // Debug.Log("node: " + node.ToString()); TiledObject tiledObject = kv.Value; int objectGid = tiledObject.gid; BlockComponent blockComponent = pm.pathManager.GetBlockComponentByOrigin(this.sectionData.origin + node); if (blockComponent == null) { Debug.Log("blockComponent is null"); continue; } if (17 <= objectGid && objectGid < 33) //item { Node itemOrigin = this.sectionData.origin + node; GameObject itemPrefab = PrefabManager.Instance.GetItemPrefab((ItemGid)objectGid); // GameObject itemInstance = Instantiate(itemPrefab) as GameObject; GameObject itemInstance = ObjectPool.Spawn(itemPrefab); itemInstance.transform.SetParent(blockComponent.objectContainer); ItemComponent itemComponent = itemInstance.GetComponent <ItemComponent>(); itemComponent.InitItemComponent(this, itemOrigin, blockComponent.blockData.direction); itemComponents.Add(itemComponent); pm.pathManager.PutItemComponent(itemComponent); if (itemComponent.itemType == ItemType.food) { FoodItemComponent foodItemComponent = itemComponent.GetComponent <FoodItemComponent>(); foodItemComponent.InitFoodRender(); } } else if (33 <= objectGid && objectGid < 49) //trap { Node trapOrigin = this.sectionData.origin + node; GameObject trapPrefab = PrefabManager.Instance.GetTrapPrefab((TrapGid)objectGid); // GameObject trapInstance = Instantiate(trapPrefab) as GameObject; GameObject trapInstance = ObjectPool.Spawn(trapPrefab); trapInstance.transform.SetParent(blockComponent.objectContainer); TrapComponent trapComponent = trapInstance.GetComponent <TrapComponent>(); trapComponent.name = trapComponent.GetInstanceID().ToString(); Direction trapDirection = blockComponent.blockData.direction; if (tiledObject.properties != null) { //TODO TileProperty의 direction을 그대로 사용하는것이 아니라 //섹션의 방향에 따라 수정된 direction을 사용해야 한다 if (sectionData.direction == Direction.right) { trapDirection = tiledObject.properties.direction; } else if (sectionData.direction == Direction.up) { if (tiledObject.properties.direction == Direction.up) { trapDirection = Direction.left; } else if (tiledObject.properties.direction == Direction.right) { trapDirection = Direction.up; } else if (tiledObject.properties.direction == Direction.down) { trapDirection = Direction.right; } else if (tiledObject.properties.direction == Direction.left) { trapDirection = Direction.down; } } else if (sectionData.direction == Direction.down) { if (tiledObject.properties.direction == Direction.up) { trapDirection = Direction.right; } else if (tiledObject.properties.direction == Direction.right) { trapDirection = Direction.down; } else if (tiledObject.properties.direction == Direction.down) { trapDirection = Direction.left; } else if (tiledObject.properties.direction == Direction.left) { trapDirection = Direction.up; } } } trapComponent.InitTrapComponent(this, trapOrigin, trapDirection, tiledObject); trapComponents.Add(trapComponent); pm.pathManager.PutTrapComponent(trapComponent); } else if (49 <= objectGid && objectGid < 65) //enemy { Node itemOrigin = this.sectionData.origin + node; GameObject enemyPrefab = PrefabManager.Instance.GetEnemyPrefab((EnemyGid)objectGid); // GameObject enemyInstance = Instantiate(enemyPrefab) as GameObject; GameObject enemyInstance = ObjectPool.Spawn(enemyPrefab); enemyInstance.transform.SetParent(blockComponent.objectContainer); EnemyComponent enemyComponent = enemyInstance.GetComponent <EnemyComponent>(); enemyComponent.InitEnemyComponent(itemOrigin, blockComponent.blockData.direction); enemyComponents.Add(enemyComponent); pm.pathManager.PutEnemyComponent(enemyComponent); } } } this.maxProgress = _maxProgress; }
void OnMoveComplete(Node beforeNode, bool isRotate) { // Debug.Log("ChampionComponent.OnMoveComplete()"); isSliping = false; animator.SetBool("isCrouch", false); int addScore = 0; BlockComponent beforeBlockComponent = pm.pathManager.GetBlockComponentByOrigin(beforeNode); BlockComponent currentBlockComponent = pm.pathManager.GetBlockComponentByOrigin(this.origin); if (currentBlockComponent == null) { //there is no block blow player TakeDamage(currentHp, DamageType.drop); } else { if ((beforeBlockComponent.sectionComponent != currentBlockComponent.sectionComponent)) { pm.pathManager.currentSectionComponent = currentBlockComponent.sectionComponent; } if ((beforeBlockComponent.sectionComponent != currentBlockComponent.sectionComponent) && (currentBlockComponent.sectionComponent.sectionData.sectionType == SectionType.straight) && (currentBlockComponent.blockData.progress > progress)) { //time to generate more section pm.pathManager.AddSection(pm.playMode); } ItemComponent itemComponent = pm.pathManager.GetItemComponent(this.origin); if (itemComponent != null) { if (!gotItem) { gotItem = true; } pm.AddCombo(); if (!string.IsNullOrEmpty(itemComponent.sfx)) { SoundManager.Instance.Play(itemComponent.sfx); } //eat item and destroy if (itemComponent.itemType == ItemType.hp) { AddHp((int)itemComponent.value); pm.uiManager.UpdateHpUI(true); addScore += 2; pm.score += 2; } else if (itemComponent.itemType == ItemType.sp) { AddSp(itemComponent.value); pm.uiManager.UpdateSp(); addScore += 2; pm.score += 2; } else if (itemComponent.itemType == ItemType.coin) { pm.totalCoin += (int)itemComponent.value; pm.addCoin += (int)itemComponent.value; GameManager.Instance.SetPlayerCoinToPref(pm.totalCoin); pm.uiManager.UpdateCoin(true); addScore += 1; pm.score += 1; } else if (itemComponent.itemType == ItemType.heart) { int addHp = (int)itemComponent.value; pm.champion.maxHp += addHp; pm.champion.maxHp = Mathf.Clamp(pm.champion.maxHp, 1, 14); pm.champion.currentHp += addHp; pm.champion.currentHp = Mathf.Clamp(pm.champion.currentHp, 1, 14); pm.uiManager.InitHpUI(pm.champion.maxHp, pm.champion.currentHp, true); addScore += 5; pm.score += 5; } pm.pathManager.RemoveItemComponent(itemComponent); currentBlockComponent.sectionComponent.itemComponents.Remove(itemComponent); // Destroy(itemComponent.gameObject); ObjectPool.Recycle(itemComponent); } else { pm.ResetCombo(); gotItem = false; } if (beforeBlockComponent != currentBlockComponent && currentBlockComponent.terrainGid == TerrainGid.water) { isWatered = true; } if (currentBlockComponent.hasStepEffect) { currentBlockComponent.MakeStepEffect(); } if (currentBlockComponent.terrainGid == TerrainGid.cracked) { currentBlockComponent.StartCollapse(1.5f, 1.5f, true); } else if (currentBlockComponent.terrainGid == TerrainGid.magma) { MagmaComponent magmaComponent = currentBlockComponent.GetComponentInChildren <MagmaComponent>(); if (magmaComponent.isHot) { TakeDamage(magmaComponent.attack, DamageType.magma); } } else if (currentBlockComponent.terrainGid == TerrainGid.ice) { //한칸 앞으로 미끄러져 이동해야한다 Node targetNode = origin; if (currentBlockComponent.blockData.direction == Direction.right) { targetNode += new Node(1, 0); } else if (currentBlockComponent.blockData.direction == Direction.up) { targetNode += new Node(0, 1); } else if (currentBlockComponent.blockData.direction == Direction.down) { targetNode += new Node(0, -1); } TrapComponent _trapComponent = pm.pathManager.GetTrapComponent(targetNode); if (_trapComponent == null || !_trapComponent.isObstacle) { MoveChampion(origin, targetNode, GameManager.championMoveDuration, MoveType.slip, true); } } else if (currentBlockComponent.terrainGid == TerrainGid.finish) { //finish! pm.pathManager.currentSectionComponent.StopCollapse(); pm.isClear = true; gameObject.transform.SetParent(currentBlockComponent.objectContainer); animator.SetTrigger("finish"); currentBlockComponent.Finish(); Vector3 targetRotation = pm.cameraController.pivot.rotation.eulerAngles + new Vector3(0, 180, 0); pm.cameraController.AnimatePivotAngle(Quaternion.Euler(targetRotation), 0.5f); pm.GameOver("Clear", "", true); } // 새로운 섹션에 도착했고 해당 섹션은 스트레이트 세션이다 // 도착한 섹션에다가 자동파괴명령을 내리자 if (beforeBlockComponent.sectionComponent != currentBlockComponent.sectionComponent) { if (currentBlockComponent.sectionComponent.sectionData.sectionType == SectionType.straight) { currentBlockComponent.sectionComponent.StartCollapse(1.5f, 1.5f); } else if (currentBlockComponent.sectionComponent.sectionData.sectionType == SectionType.corner) { currentBlockComponent.sectionComponent.StartCollapse(1.5f, 3.0f); } } // Debug.Log("currentBlockComponent.blockData.progress: " + currentBlockComponent.blockData.progress.ToString()); // Debug.Log("progress: " + progress.ToString()); if (currentBlockComponent.blockData.progress > progress) { // Debug.Log("Here"); pm.AddDistance(currentBlockComponent.blockData.progress - progress, !gotItem); progress = currentBlockComponent.blockData.progress; } // if (currentBlockComponent.sectionComponent.sectionData.sectionType == SectionType.straight) // { // currentBlockComponent.sectionComponent.StartCollapse(progress); // } TrapComponent trapComponent = pm.pathManager.GetTrapComponent(this.origin); if (trapComponent != null) { if (trapComponent.trapType == TrapType.thornfloor && trapComponent.isThornUp) { trapComponent.ThornfloorAttack(); } else if (trapComponent.trapType == TrapType.jawmachine && !trapComponent.isInvoked) { trapComponent.JawmachineAttack(); } else if (trapComponent.trapType == TrapType.pushpad) { trapComponent.PushpadAction(this, origin, beforeNode); } } } if (!isDead && // !isRotate && currentBlockComponent != null && currentBlockComponent.sectionComponent.sectionData.sectionType == SectionType.straight && currentBlockComponent.blockData.progress >= progress && beforeBlockComponent != currentBlockComponent) { // CameraWork(currentBlockComponent); } if (isRotate) { // Debug.Log("champion rotate"); Quaternion targetRotation = Quaternion.identity; if (currentBlockComponent.sectionComponent.sectionData.direction == Direction.right) { if (currentBlockComponent.sectionComponent.beforeSectionComponent == null) { if (currentBlockComponent.sectionComponent.nextSectionComponent.nextSectionComponent.sectionData.direction == Direction.up) { targetRotation = Quaternion.Euler(pm.cameraController.championRightUpAngle); } else if (currentBlockComponent.sectionComponent.nextSectionComponent.nextSectionComponent.sectionData.direction == Direction.down) { targetRotation = Quaternion.Euler(pm.cameraController.championRightDownAngle); } } else if (currentBlockComponent.sectionComponent.beforeSectionComponent.beforeSectionComponent == null) { if (currentBlockComponent.sectionComponent.nextSectionComponent.nextSectionComponent.sectionData.direction == Direction.up) { targetRotation = Quaternion.Euler(pm.cameraController.championRightUpAngle); } else if (currentBlockComponent.sectionComponent.nextSectionComponent.nextSectionComponent.sectionData.direction == Direction.down) { targetRotation = Quaternion.Euler(pm.cameraController.championRightDownAngle); } } else if (currentBlockComponent.sectionComponent.beforeSectionComponent.beforeSectionComponent.sectionData.direction == Direction.down) { targetRotation = Quaternion.Euler(pm.cameraController.championRightDownAngle); } else if (currentBlockComponent.sectionComponent.beforeSectionComponent.beforeSectionComponent.sectionData.direction == Direction.up) { targetRotation = Quaternion.Euler(pm.cameraController.championRightUpAngle); } } else if (currentBlockComponent.sectionComponent.sectionData.direction == Direction.up) { targetRotation = Quaternion.Euler(pm.cameraController.championUpAngle); } else if (currentBlockComponent.sectionComponent.sectionData.direction == Direction.down) { targetRotation = Quaternion.Euler(pm.cameraController.championDownAngle); } pm.cameraController.AnimatePivotAngle(targetRotation, 0.3f); } if (addScore > 0) { pm.uiManager.UpdateScoreUI(pm.score, addScore); } }