void onAttackOverItem() { clearJumpHP(); for (int i = 0; i < resultItem.Count; i++) { string path = "Prefab/Misc/MAN_RES"; GameBattleUnit u = resultItem[i].unit; if (u == null) { onMoveOver(); return; } GameObject obj = Instantiate <GameObject>(Resources.Load <GameObject>(path)); GameAnimation gameAnimation = obj.GetComponent <GameAnimation>(); gameAnimation.offsetX = GameDefine.BATTLE_OFFSET_X; gameAnimation.offsetY = GameDefine.BATTLE_OFFSET_Y; Transform trans = obj.transform; trans.SetParent(transform); trans.localScale = Vector3.one; trans.position = new Vector3(u.PosBattleX, u.PosBattleY + GameBattleManager.instance.LayerHeight, transform.localPosition.z); string path1 = "Prefab/JumpHPMap"; GameObject obj1 = Instantiate <GameObject>(Resources.Load <GameObject>(path1)); GameBattleJumpHPMap jumpHP = obj1.GetComponent <GameBattleJumpHPMap>(); Vector3 screenPos = GameCameraManager.instance.mainCamera.WorldToScreenPoint(trans.position); screenPos.z = 0; RectTransform trans1 = obj1.GetComponent <RectTransform>(); trans1.SetParent(GameObject.Find("Canvas/UI/Center/JumpHPMap").transform); trans1.localScale = Vector3.one; trans1.position = screenPos; trans1.anchoredPosition = new Vector2(GameDefine.TEXTURE_WIDTH_HALF + trans1.anchoredPosition.x, trans1.anchoredPosition.y - GameDefine.TEXTURE_HEIGHT); jumpHPlist.Add(jumpHP); int animationStart = 2; int animationEnd = 10; OnEventOver over = null; switch (resultItem[i].type) { case GameItemUseType.Cure: animationStart = 46; animationEnd = 60; over = onResOverItem; break; case GameItemUseType.Recovery: animationStart = 60; animationEnd = 81; over = onJumpHPOver; break; case GameItemUseType.Limit: animationStart = 46; animationEnd = 60; over = onJumpHPOver; break; } if (i == 0) { gameAnimation.playSound = true; gameAnimation.playAnimation(animationStart, animationEnd, false, over); } else { gameAnimation.playSound = false; gameAnimation.playAnimation(animationStart, animationEnd, false, null); } } }
void onAttackOver() { clear(); if (skill != null && (skill.BattleType == GameSkillBattleType.Map || skill.BattleType == GameSkillBattleType.Normal)) { unit.playAnimationBattle(GameAnimationType.Stand, unit.Direction, null); } bool b = false; for (int i = 0; i < result.Count; i++) { string path = "Prefab/Misc/MAN_RES"; GameBattleUnit u = result[i].unit; if (u == null) { onMoveOver(); return; } GameObject obj = Instantiate <GameObject>(Resources.Load <GameObject>(path)); GameAnimation gameAnimation = obj.GetComponent <GameAnimation>(); gameAnimation.offsetX = GameDefine.BATTLE_OFFSET_X; gameAnimation.offsetY = GameDefine.BATTLE_OFFSET_Y; Transform trans = obj.transform; trans.SetParent(transform); trans.localScale = Vector3.one; trans.position = new Vector3(u.PosBattleX, u.PosBattleY + GameBattleManager.instance.LayerHeight, transform.localPosition.z); string path1 = "Prefab/JumpHPMap"; GameObject obj1 = Instantiate <GameObject>(Resources.Load <GameObject>(path1)); GameBattleJumpHPMap jumpHP = obj1.GetComponent <GameBattleJumpHPMap>(); Vector3 screenPos = GameCameraManager.instance.mainCamera.WorldToScreenPoint(trans.position); screenPos.z = 0; RectTransform trans1 = obj1.GetComponent <RectTransform>(); trans1.SetParent(GameObject.Find("Canvas/UI/Center/JumpHPMap").transform); trans1.localScale = Vector3.one; trans1.position = screenPos; trans1.anchoredPosition = new Vector2(GameDefine.TEXTURE_WIDTH_HALF + trans1.anchoredPosition.x, trans1.anchoredPosition.y - GameDefine.TEXTURE_HEIGHT); jumpHPlist.Add(jumpHP); int animationStart = 2; int animationEnd = 10; switch (result[i].type) { case GameSkillResutlType.Damage: animationStart = 2; animationEnd = 10; break; case GameSkillResutlType.Cure: animationStart = 46; animationEnd = 60; break; case GameSkillResutlType.Purge: animationStart = 60; animationEnd = 81; break; case GameSkillResutlType.Blessing: animationStart = 18; animationEnd = 32; break; case GameSkillResutlType.Curse: animationStart = 32; animationEnd = 46; break; case GameSkillResutlType.None: case GameSkillResutlType.Special: { animationStart = 81; animationEnd = 99; if (result[i].HP > 0 || result[i].MP > 0) { if (skill != null && (skill.OtherEffect == GameSkillOtherEffect.HealAll || skill.OtherEffect == GameSkillOtherEffect.MPAdd)) { animationStart = 46; animationEnd = 60; } else { animationStart = 2; animationEnd = 10; } } } break; } OnEventOver over = null; if (result[i].type == GameSkillResutlType.Damage || result[i].HP != 0 || result[i].MP != 0) { over = onResOver; } else { over = onJumpHPOver; } b = true; gameAnimation.playSound = (i == 0); if (i == 0) { gameAnimation.playAnimation(animationStart, animationEnd, false, over); } else { gameAnimation.playAnimation(animationStart, animationEnd, false, null); } } if (!b) { onJumpHPOver(); } }