public int GetCoinNum() { int ret = stage_id * 3; ret += UtilRand.GetRand(3); return(ret); }
public string GetAssetName(int _iVliceType, bool _bAddPath = false) { List <CsvVoicesetData> sound_list = new List <CsvVoicesetData> (); foreach (CsvVoicesetData data in DataManagerAlarm.Instance.master_voiceset_list) { if (_iVliceType == data.id) { sound_list.Add(data); } } int iIndex = UtilRand.GetRand(sound_list.Count); CsvVoicesetData use_data = sound_list [iIndex]; string strRet = ""; if (_bAddPath == false) { strRet = use_data.name; } else { strRet = string.Format("{0}/{1}.{2}", use_data.path, use_data.name, use_data.kakucho); } return(strRet); }
private void create_enemies(int _iCurrentFloor, string _strDungeonId) { gameMain.ClearEnemy(); MasterFloorParam floor_param = DataManager.Instance.masterFloor.list.Find(p => p.dungeon_id == _strDungeonId && (p.start <= _iCurrentFloor && _iCurrentFloor <= p.end)); int[] enemy_index_prob = floor_param.GetEnemyIndexProb(); int enemy_num = UtilRand.GetRand(10, 3); int[] pos_index = new int[enemy_num]; int[] pos_index_prob = new int[10]; for (int i = 0; i < 10; i++) { pos_index_prob[i] = 100; } for (int i = 0; i < enemy_num; i++) { int iResult = UtilRand.GetIndex(pos_index_prob); pos_index[i] = iResult; pos_index_prob[iResult] = 0; //Debug.Log(iResult); } for (int i = 0; i < enemy_num; i++) { //float x = UtilRand.GetRange(8.5f, 3.5f); float x = 3.5f + ((8.5f - 3.5f) / 10.0f) * pos_index[i]; int index = UtilRand.GetIndex(enemy_index_prob); int enemy_id = floor_param.GetEnemyId_fromIndex(index); MasterEnemyParam enemy = DataManager.Instance.masterEnemy.list.Find(p => p.enemy_id == enemy_id); gameMain.CreateEnemy(enemy, x, false); } if (_iCurrentFloor % 10 == 0) { MasterEnemyParam boss = DataManager.Instance.masterEnemy.list.Find(p => p.enemy_id == floor_param.boss); DataEnemyParam data = gameMain.CreateEnemy(boss, 9.0f, true); gameMain.panelBossStatus.Initialize(data, boss); } else { gameMain.panelBossStatus.Disable(); } }
public int CalcDamage(DataUnitParam _target, MasterSkillParam _skill, MasterWeaponParam _weapon) { int use_attack = attack; if (_weapon != null) { //Debug.Log(_weapon.weapon_type); if (_weapon.weapon_type == "hammer") { use_attack /= 2; } else if (_weapon.weapon_type == "dagger") { use_attack = use_attack + use_attack / 2; } else { } } //Debug.Log(string.Format("{0}:{1}", attack, use_attack)); float base_damage = (use_attack * 3 - _target.def) * 0.717f; //Debug.Log(base_damage); if (base_damage < 1.0f) { base_damage = 1.0f; } float skill_rate = 1.0f; if (_skill != null) { skill_rate = _skill.param * 0.01f; } float[] rand_rate_table = { 0.98f, 0.99f, 1.00f, 1.01f, 1.02f }; //int[] rand_add_table = { 0,1,2,3,4 }; int[] rand_add_table = { 0, 1, 1, 2, 2 }; int index_rand_rate = UtilRand.GetRand(rand_rate_table.Length); int index_rand_add = UtilRand.GetRand(rand_add_table.Length); float fRet = (base_damage * skill_rate * rand_rate_table[index_rand_rate]) + rand_add_table[index_rand_add]; if (fRet < 1.0f) { fRet = 1.0f; } return((int)fRet); }
public override void OnEnter() { base.OnEnter(); int select_index = UtilRand.GetRand(roulette.banner_list.Count); roulette.BannerActive(select_index); MasterItemParam master_item = roulette.GetBannerItem(select_index); get_item_id.Value = master_item.item_id; roulette.m_txtMessage.text = string.Format("<color=#0FF>{0}</color>\nを手に入れました", master_item.name); Finish(); }
public void CallVoice(int _iVliceType) { List <string> sound_list = new List <string> (); foreach (CsvVoicesetData data in DataManagerAlarm.Instance.master_voiceset_list) { if (_iVliceType == data.id) { sound_list.Add(data.name); } } int iIndex = UtilRand.GetRand(sound_list.Count); SoundManager.Instance.PlaySE(sound_list[iIndex]); return; }
public override void OnEnter() { base.OnEnter(); temp_serial = -1; select(temp_serial); foreach (Card c in panel.card_list) { c.OnClickCard.AddListener(OnClickCard); } aging_timer = 0.0f; int aging_index = UtilRand.GetRand(panel.card_list.Count); temp_serial_aging = panel.card_list[aging_index].data_card.card_serial; panel.m_btnDecide.interactable = false; panel.m_btnDecide.onClick.AddListener(OnDecide); }
private IEnumerator spin() { bool bPushed = false; m_btnDecide.onClick.AddListener(() => { bPushed = true; }); while (bPushed == false) { yield return(new WaitForSeconds(0.1f)); int show_index = UtilRand.GetRand(m_bannerList.Count); ShowBanner(show_index); } m_btnDecide.onClick.RemoveAllListeners(); }
public string GetItemRouletteResult(int _iNum) { string ret = ""; ItemResult result = new ItemResult(); result.keys = new List <string>(); for (int i = 0; i < _iNum; i++) { int iTempIndex = UtilRand.GetIndex(m_iProbList); result.keys.Add(m_getItemList[iTempIndex].item_key); } result.result_index = UtilRand.GetRand(m_getItemList.Count); ret = JsonUtility.ToJson(result); //Debug.Log(ret); return(ret); }
private IEnumerator HealEffectAppear(BattleIcon arg0) { // この微妙なずらし作業がしたかっただけ yield return(new WaitForSeconds(0.5f)); int iHeal = 12; int iSwing = UtilRand.GetRand(5) - 2; if (is_player.Value) { DataUnitParam unit_chara = DataManagerGame.Instance.dataUnit.list.Find(p => p.chara_id == select_chara_id.Value && p.unit == "chara"); iHeal = unit_chara.heal + iSwing; } else { DataUnitParam unit_enemy = DataManagerGame.Instance.dataUnit.list.Find(p => p.unit == "enemy"); iHeal = unit_enemy.heal + iSwing; } //Debug.Log(iDamage); battleMain.Heal(is_player.Value, iHeal, OnHealFinished); // プレイヤー側の攻撃 if (arg0.is_left) { DataUnitParam unit_chara = DataManagerGame.Instance.dataUnit.list.Find(p => p.chara_id == select_chara_id.Value && p.unit == "chara"); unit_chara.HpHeal(iHeal); GameMain.Instance.CharaRefresh(); } else { DataUnitParam unit_enemy = DataManagerGame.Instance.dataUnit.list.Find(p => p.unit == "enemy"); unit_enemy.HpHeal(iHeal); } battleMain.HpRefresh(); }
private IEnumerator DamageEffectAppear(BattleIcon arg0) { // この微妙なずらし作業がしたかっただけ yield return(new WaitForSeconds(0.5f)); int iDamage = 12; int iSwing = UtilRand.GetRand(5) - 2; if (is_player.Value) { DataUnitParam unit_chara = DataManagerGame.Instance.dataUnit.list.Find(p => p.chara_id == select_chara_id.Value && p.unit == "chara"); switch (arg0.master_symbol.card_symbol_id) { case Defines.CARD_SYMBOL_ATTACK: iDamage = unit_chara.str + iSwing; break; case Defines.CARD_SYMBOL_MAGIC: iDamage = unit_chara.magic + iSwing; break; default: break; } } else { DataUnitParam unit_enemy = DataManagerGame.Instance.dataUnit.list.Find(p => p.unit == "enemy"); switch (arg0.master_symbol.card_symbol_id) { case Defines.CARD_SYMBOL_ATTACK: iDamage = unit_enemy.str + iSwing; break; case Defines.CARD_SYMBOL_MAGIC: iDamage = unit_enemy.magic + iSwing; break; default: break; } } //Debug.Log(iDamage); battleMain.Damage(is_player.Value, iDamage, OnDamageFinished); // プレイヤー側の攻撃 if (arg0.is_left) { DataUnitParam enemy = DataManagerGame.Instance.dataUnit.list.Find(p => p.unit == "enemy"); //Debug.Log(enemy.hp); enemy.hp -= iDamage; } else { DataUnitParam select_chara = DataManagerGame.Instance.dataUnit.list.Find(p => p.chara_id == GameMain.Instance.SelectCharaId && p.unit == "chara"); select_chara.hp -= iDamage; GameMain.Instance.CharaRefresh(); } battleMain.HpRefresh(); }
void Update() { bool bInit = false; if (m_eStepPre != m_eStep) { m_eStepPre = m_eStep; bInit = true; } switch (m_eStep) { case STEP.START: if (bInit) { m_fTimer = 0.0f; m_UnderNumberRed.Initialize(m_DotManager.GetNumber(DefineProject.DOT_COLOR.RED)); m_UnderNumberBlue.Initialize(m_DotManager.GetNumber(DefineProject.DOT_COLOR.BLUE)); if (DataManagerEqual.Instance.m_iPlayLevel == 0) { DataManagerEqual.Instance.m_iPlayLevel = 1; } CsvLevelData level_data = DataManagerEqual.Instance.GetLevelData(DataManagerEqual.Instance.m_iPlayLevel); m_DotManager.Initialize(level_data); m_UnderNumberRed.SetNumber(m_DotManager.GetNumber(DefineProject.DOT_COLOR.RED)); m_UnderNumberBlue.SetNumber(m_DotManager.GetNumber(DefineProject.DOT_COLOR.BLUE)); m_lbHeaderLevel.text = string.Format("Level {0}", DataManagerEqual.Instance.m_iPlayLevel); } m_fTimer += Time.deltaTime; if (0.5f < m_fTimer) { m_eStep = STEP.SKIT; } break; case STEP.SKIT: if (bInit) { FadeInOut.Instance.Open(0.25f); } if (FadeInOut.Instance.IsIdle()) { ShowAd(true); m_eStep = STEP.IDLE; } break; case STEP.IDLE: if (bInit) { m_DotManager.ButtonInit(); m_DotManager.TriggerClearAll(); m_btnBack.TriggerClear(); m_btnHelp.TriggerClear(); } if (m_DotManager.ButtonPushed) { m_eStep = STEP.CLICK_DOT; } else if (m_btnBack.ButtonPushed) { m_eStep = STEP.BACK_SELECT; } else if (m_btnHelp.ButtonPushed) { m_eStep = STEP.HELP; } else { } // 最初の方だけ出る if (DataManagerEqual.Instance.m_iPlayLevel < 10) { if (m_telop.IsIdle()) { int iMessageIndex = UtilRand.GetRand(TELOP_MESSAGE_ARR.Length); m_telop.SetTelop(TELOP_MESSAGE_ARR [iMessageIndex]); } } break; case STEP.HELP: if (bInit) { #if UNITY_ANDROID m_NendAdIcon.Hide(); #endif m_Page = PrefabManager.Instance.MakeScript <HelpMain> ("prefab/RootHelp", m_goDispRoot); m_Page.PageStart(); } if (m_Page.IsEnd()) { m_eStep = STEP.IDLE; Destroy(m_Page.gameObject); #if UNITY_ANDROID m_NendAdIcon.Show(); #endif } break; case STEP.CLICK_DOT: if (bInit) { int iClickedDotIndex = m_DotManager.Index; m_DotManager.ChangeDotColor(iClickedDotIndex, 3, true); m_UnderNumberRed.SetNumber(m_DotManager.GetNumber(DefineProject.DOT_COLOR.RED)); m_UnderNumberBlue.SetNumber(m_DotManager.GetNumber(DefineProject.DOT_COLOR.BLUE)); } m_eStep = STEP.CLEAR_CHECK; break; case STEP.CLEAR_CHECK: if (m_DotManager.IsClear(ref m_iClearScore, new int[(int)DefineProject.DOT_COLOR.MAX] { 0, 3, 3, 0 })) { m_eStep = STEP.CLEAR; } else { m_eStep = STEP.IDLE; } break; case STEP.CLEAR: if (bInit) { // サーバー側で設定した回数で表示される NendAdInterstitial.Instance.Show(DefineProject.NEND_AD_INTER_SPOT_ID); DataManagerEqual.Instance.SetStageStatus(DataManagerEqual.Instance.m_iPlayLevel, DefineProject.STAGE_STATUS.CLEARED); if (DataManagerEqual.Instance.GetStageStatus(DataManagerEqual.Instance.m_iPlayLevel + 1) == DefineProject.STAGE_STATUS.NONE) { DataManagerEqual.Instance.SetStageStatus(DataManagerEqual.Instance.m_iPlayLevel + 1, (DefineProject.STAGE_STATUS.NO_PLAY)); } m_ClearDialog.gameObject.SetActive(true); TweenAlphaAll(m_ClearDialog.gameObject, 0.0f, 0.0f); TweenAlphaAll(m_ClearDialog.gameObject, 0.5f, 1.0f); m_ClearDialog.Initialize(DataManagerEqual.Instance.m_iPlayLevel, m_iClearScore); m_btnBack.TriggerClear(); ShowAd(false); } if (m_ClearDialog.IsNext()) { m_eStep = STEP.NEXT; TweenAlphaAll(m_ClearDialog.gameObject, 0.5f, 0.0f); } if (m_btnBack.ButtonPushed) { m_eStep = STEP.BACK_SELECT; } break; case STEP.NEXT: if (bInit) { DataManagerEqual.Instance.m_iPlayLevel += 1; m_eStep = STEP.START; } break; case STEP.BACK_SELECT: if (bInit) { ShowAd(false); FadeInOut.Instance.Close(0.25f); } if (FadeInOut.Instance.IsIdle()) { SceneManager.LoadScene("select"); } break; case STEP.MAX: default: break; } }
public void ChangeActive() { int index = UtilRand.GetRand(banner_list.Count); BannerActive(index); }