/// <summary> /// 触发毒陷阱 /// </summary> /// <returns>The trap triggered.</returns> /// <param name="battlePlayer">Battle player.</param> private IEnumerator PoisonTrapTriggered(BattlePlayerController battlePlayer) { int count = 0; battlePlayer.SetEffectAnim(CommonData.poisonedEffectName, null, 0, 3f); while (count < 3) { yield return(new WaitForSeconds(1f)); yield return(new WaitUntil(() => !battlePlayer.isInEvent)); MyTowards towards = battlePlayer.GetReversedTowards(); battlePlayer.AddHurtAndShow(100, HurtType.Physical, towards); ExploreManager.Instance.expUICtr.UpdatePlayerStatusBar(); if (battlePlayer.agent.health <= 0) { //ExploreManager.Instance.DisableAllInteractivity(); battlePlayer.AgentDie(); yield break; } count++; } }
private void PlayLevelUpAnim() { battlePlayerCtr.SetEffectAnim("LevelUp", delegate { EnableInteractivity(); }); expUICtr.GetComponent <BattlePlayerUIController> ().UpdateAgentStatusPlane(); SoundManager.Instance.PlayAudioClip("Other/sfx_LevelUp"); }
public void EnterHole(MapGenerator mapGenerator, BattlePlayerController bp) { bp.ActiveBattlePlayer(false, false, false); List <Hole> allHolesInMap = mapGenerator.GetAllHolesInMap(); Hole randomOtherHole = GetRandomOtherHole(allHolesInMap); Debug.LogFormat("hole found,time:{0}", Time.realtimeSinceStartup); mapGenerator.GetComponent <ExploreManager> ().DisableInteractivity(); Vector3 otherHolePosition = new Vector3(randomOtherHole.transform.position.x, randomOtherHole.transform.position.y, 0); Vector3 moveVector = otherHolePosition - bp.transform.position; Transform background = Camera.main.transform.Find("Background"); Vector3 backgroundImageTargetPos = background.localPosition + new Vector3(moveVector.x * 0.3f, moveVector.y * 0.3f, 0); Vector3 walkablePositionAround = mapGenerator.GetARandomWalkablePositionAround(otherHolePosition); bp.SetEffectAnim("HoleFog"); // mapGenerator.PlayMapOtherAnim ("HoleFog", this.transform.position); if (randomOtherHole.transform.position.z != 0) { mapGenerator.DirectlyShowSleepingTilesAtPosition(otherHolePosition); } mapGenerator.ItemsAroundAutoIntoLifeWithBasePoint(otherHolePosition); bp.transform.DOMove(otherHolePosition, 1).OnComplete(delegate { IEnumerator WalkOutOfHoleCoroutine = WalkOutOfHole(mapGenerator, walkablePositionAround, bp, randomOtherHole); StartCoroutine(WalkOutOfHoleCoroutine); }); background.transform.DOMove(backgroundImageTargetPos, 1); }
private IEnumerator WalkOutOfHole(MapGenerator mapGenerator, Vector3 walkablePositionAround, BattlePlayerController bp, Hole targetHole) { targetHole.bc2d.enabled = false; int[,] mapWalkableInfo = mapGenerator.mapWalkableInfoArray; yield return(new WaitUntil(() => mapWalkableInfo[(int)walkablePositionAround.x, (int)walkablePositionAround.y] == 1)); bp.SetEffectAnim("HoleFog"); // mapGenerator.PlayMapOtherAnim("HoleFog",targetHole.transform.position); Debug.LogFormat("around items come to life,time:{0}", Time.realtimeSinceStartup); bp.MoveToPosition(walkablePositionAround, mapGenerator.mapWalkableInfoArray); yield return(new WaitUntil(() => bp.isIdle)); Debug.LogFormat("player move End:{0}", Time.realtimeSinceStartup); targetHole.bc2d.enabled = true; mapGenerator.GetComponent <ExploreManager> ().EnableInteractivity(); }
/// <summary> /// 播放升级动画 /// </summary> private void PlayLevelUpAnim() { battlePlayerCtr.SetEffectAnim(CommonData.levelUpEffectName); GameManager.Instance.soundManager.PlayAudioClip(CommonData.levelUpAudioName); }