private void SetDamageText(DamageParam param) { UIDamageText damageText = null; if (PoolManager.Instance != null && PoolManager.Instance.GetDamageTextFromPool(out damageText)) { damageText.Init(effectDummy, param); } else { LoadAssetbundle.LoadPrefabCB loadDamageTextPrefabCB = new LoadAssetbundle.LoadPrefabCB(LoadDamageTextCompleteCB); PrefabManager.Instance.LoadPrefab("Effect/Text_Damage", System.Guid.NewGuid(), loadDamageTextPrefabCB, param); } }
public void SetBuffText(string text) { UIDamageText buffText = null; if (PoolManager.Instance != null && PoolManager.Instance.GetEffectTextFromPool(out buffText)) { buffText.Init(transform, text); } else { LoadAssetbundle.LoadPrefabCB loadBuffTextPrefabCB = new LoadAssetbundle.LoadPrefabCB(LoadBuffTextCompleteCB); PrefabManager.Instance.LoadPrefab("Effect/Text_Effect", System.Guid.NewGuid(), loadBuffTextPrefabCB, text); } }
private void SetDamageText(int damage, eDamageTextType type) { UIDamageText damageText = null; if (PoolManager.Instance != null && PoolManager.Instance.GetDamageTextFromPool(type, out damageText)) { damageText.Init(damageDummy != null ? damageDummy : transform, damage); } else { LoadAssetbundle.LoadPrefabCB loadDamageTextPrefabCB = new LoadAssetbundle.LoadPrefabCB(LoadDamageTextCompleteCB); PrefabManager.Instance.LoadPrefab(GameManager.Instance.GetDamagePath(type), System.Guid.NewGuid(), loadDamageTextPrefabCB, damage); } }
private void LoadBuffTextCompleteCB(GameObject gameObj, System.Guid uid, params object[] param) { if (gameObj != null) { GameObject createObj = Instantiate(gameObj) as GameObject; createObj.transform.parent = GameManager.Instance.rootPanelArray[(int)GameManager.eRootPanelType.Type_Effect].transform; createObj.transform.localScale = gameObj.transform.localScale; UIDamageText buffText = createObj.GetComponent <UIDamageText>(); if (buffText != null) { buffText.Init(transform, (string)param[0]); } } }
private void LoadDamageTextCompleteCB(GameObject gameObj, System.Guid uid, params object[] param) { if (gameObj != null) { GameObject createObj = Instantiate(gameObj) as GameObject; createObj.transform.parent = GameManager.Instance.rootArray[(int)GameManager.eRootType.Type_Damage].transform; createObj.transform.localScale = gameObj.transform.localScale; UIDamageText damageText = createObj.GetComponent <UIDamageText>(); if (damageText != null) { damageText.Init(damageDummy != null ? damageDummy : transform, (int)param[0]); } } }
private void LoadDamageTextCompleteCB(GameObject gameObj, System.Guid uid, params object[] param) { if (gameObj != null) { GameObject createObj = Instantiate(gameObj) as GameObject; createObj.transform.parent = GameManager.Instance.rootPanelArray[(int)GameManager.eRootPanelType.Type_Effect].transform; createObj.transform.localScale = gameObj.transform.localScale; UIDamageText damageText = createObj.GetComponent <UIDamageText>(); DamageParam damageParam = (DamageParam)param[0]; if (damageText != null) { damageText.Init(effectDummy, damageParam); } } }
private void LoadDamageTextCompleteCB(GameObject gameObj, System.Guid uid, params object[] param) { if (gameObj != null) { GameObject createObj = Instantiate(gameObj) as GameObject; createObj.transform.parent = GameManager.Instance.rootPanelArray[(int)GameManager.eRootPanelType.Type_Effect].transform; createObj.transform.localScale = gameObj.transform.localScale; createObj.transform.localPosition = Vector3.one * 9999.0f; UIDamageText damageText = createObj.GetComponent <UIDamageText>(); if (damageText != null) { damageText.Init(null, ""); } } }
public IEnumerator BattleStart(Monster.Meta monsterMeta) { Util.EventSystem.Publish(EventID.Dungeon_Battle_Start); turn_count = 0; battle_pause = true; player_attack_per_second = Mathf.Max(0.35f, GameManager.Instance.player.speed / monsterMeta.speed); player_attack_per_second = Mathf.Min(3.5f, player_attack_per_second); enemy_attack_per_second = 1.0f; player_preemptive_score = player_attack_per_second; enemy_preemptive_score = enemy_attack_per_second; battle_result = BattleResult.Invalid; monster.gameObject.SetActive(true); monster.Init(monsterMeta, dungeon.level); InitButtons(); GameManager.Instance.player.on_attack = null; GameManager.Instance.player.on_attack += (Unit.AttackResult result) => { AudioManager.Instance.Play(AudioManager.BATTLE_ATTACK, false); SceneDungeon.log.Write(GameText.GetText("DUNGEON/BATTLE/HIT", "You", monster.meta.name) + "(-" + (int)result.damage + ")"); }; GameManager.Instance.player.on_defense = null; GameManager.Instance.player.on_defense += (Unit.AttackResult result) => { iTween.ShakePosition(Camera.main.gameObject, new Vector3(0.3f, 0.3f, 0.0f), 0.2f); Effect_PlayerDamage effectPlayerDamage = player_damage_effects[Random.Range(0, player_damage_effects.Length)]; effectPlayerDamage.gameObject.SetActive(true); UIDamageText damageText = GameObject.Instantiate <UIDamageText>(damage_text_prefab); damageText.gameObject.SetActive(false); damageText.Init(result, Color.red); damageText.transform.SetParent(player_health.transform, false); damageText.transform.localPosition = new Vector3(player_health.rect.x + player_health.rect.width * player_health.gauge.fillAmount, player_health.rect.y + player_health.rect.height / 2, 0.0f); damage_texts.Add(damageText); player_health.current = GameManager.Instance.player.cur_health; }; monster.data.on_attack = null; monster.data.on_attack += (Unit.AttackResult result) => { AudioManager.Instance.Play(AudioManager.BATTLE_ATTACK, false); monster.animator.SetTrigger("Attack"); SceneDungeon.log.Write("<color=red>" + GameText.GetText("DUNGEON/BATTLE/HIT", monster.meta.name, "You") + "(-" + (int)result.damage + ")</color>"); }; monster.data.on_defense = null; monster.data.on_defense += (Unit.AttackResult result) => { StartCoroutine(monster.OnDamage(result)); UIDamageText damageText = GameObject.Instantiate <UIDamageText>(damage_text_prefab); damageText.gameObject.SetActive(false); damageText.Init(result, Color.white); if ("" == result.type) { damageText.life_time = 0.8f; damageText.transform.SetParent(monster.ui_health.transform, false); damageText.transform.localPosition = new Vector3(monster.ui_health.rect.x + monster.ui_health.rect.width * monster.ui_health.gauge.fillAmount, monster.ui_health.rect.y + monster.ui_health.rect.height / 2, 0.0f); } else { damageText.life_time = 3.0f; damageText.transform.SetParent(monster.damage_effect_spot, false); damageText.transform.localPosition = new Vector3(0.0f, 400.0f * GameManager.Instance.canvas.scaleFactor, 0.0f); } damage_texts.Add(damageText); monster.ui_health.current = monster.data.cur_health; }; yield return(StartCoroutine(monster.ColorTo(Color.black, Color.white, 1.0f))); battle_pause = false; touch_input.block_count--; while (BattleResult.Invalid == battle_result) { yield return(new WaitForSeconds(0.1f)); } touch_input.block_count++; if (BattleResult.Win == battle_result) { yield return(monster.Die()); } monster.meta = null; runaway_button.gameObject.SetActive(false); monster.gameObject.SetActive(false); //Util.EventSystem.Publish(EventID.MiniMap_Show); Util.EventSystem.Publish <BattleResult>(EventID.Dungeon_Battle_Finish, battle_result); }