public E_Winner Battle(PlayerInfo playerInfo, MosterData mosterData) { // 攻击后剩余的伤害 int pdamage = playerInfo.ATK - mosterData.DEF; if (pdamage < 0) { pdamage = 0; } int mdamage = mosterData.ATK - playerInfo.DEF; if (mdamage < 0) { mdamage = 0; } bool res = (1000 - mdamage) >= (1000 - pdamage); List <E_Winner> winners = new List <E_Winner> () { E_Winner.player, E_Winner.moster }; if (res) { winners.Reverse(); } return(CalculatWeight <E_Winner> (probability[mosterData.Rank - 1], winners.ToArray())); }
public void AddToEvolved(MosterData moster) { if (evolved_mosters_list.Contains(moster) == false) { evolved_mosters_list.Add(moster); } }
public void AddToEliminatedDark(MosterData moster) { if (eliminated_dark_mosters_list.Contains(moster) == false) { eliminated_dark_mosters_list.Add(moster); } PilliersManager.instance.RefreshPilliers(); }
public IEnumerator Coroutine_EvolutionScene(MosterData new_moster) { Debug.LogWarning("EVOLVING TO: " + new_moster.moster_name); StateManager.instance.current_states.Add(StateManager.State.SCRIPTED_EVENT); StateManager.instance.UpdateFromStates(); CameraManager.instance.SetColorToBehindPlane(Color.black); // TweenAlpha.Begin(CameraManager.instance.exploration_plane_behind_player_animation., 2f, 1f); Debug.LogWarning("waiting"); StartCoroutine(SoundManager.instance.LaunchVolumeFade( SoundManager.instance.current_music_played, 2f, SoundManager.instance.current_music_played.volume, 0f )); yield return(StartCoroutine(SpecialEffectsManager.instance.Coroutine_StartTweenAlpha( CameraManager.instance.exploration_plane_behind_player_animation.GetComponent <SpriteRenderer>(), 0f, 0.85f, 2f))); SoundManager.instance.PlayIfDifferent(SoundManager.instance.evolution_music); yield return(new WaitForSeconds(1f)); //yield return StartCoroutine(CameraManager.instance.COROUTINE_ExplorationPlaneBehindToOpaque(2f)); SoundManager.instance.PlayIndependant(SoundManager.instance.evolution_sfx); SpecialEffectsManager.instance.moster_transformation_shake.time_ratio = 1 / 6f; StartCoroutine(SpecialEffectsManager.instance.moster_transformation_shake.LaunchShake(PlayerExploration.instance.visuals_transform)); PlayerExploration.instance.generic_animator.SetBool("IsSick", true); yield return(new WaitForSeconds(3f)); CameraManager.instance.SetColorToFadePlane(Color.white); yield return(StartCoroutine(CameraManager.instance.COROUTINE_MainCameraFadeToOpaque(3f))); PlayerExploration.instance.generic_animator.SetBool("IsSick", false); //apply change MostersManager.instance.AddToEvolved(current_moster); time_lived = 0f; ApplyEvolutionChanges(new_moster); //return to exploration normal state // yield return new WaitForSeconds(0.5f); yield return(StartCoroutine(CameraManager.instance.COROUTINE_MainCameraFadeToTransparent(3f))); CameraManager.instance.SetColorToBehindPlane(Color.white); StartCoroutine(SoundManager.instance.LaunchVolumeFade( SoundManager.instance.current_music_played, 1f, SoundManager.instance.current_music_played.volume, 0f )); yield return(StartCoroutine(CameraManager.instance.COROUTINE_ExplorationPlaneBehindToTransparent(1f))); GameManager.instance.current_screen.MakeGoTo(); StateManager.instance.current_states.Remove(StateManager.State.SCRIPTED_EVENT); StateManager.instance.UpdateFromStates(); }
public void SetGameFromSaveData() { if (SaveManager.current_saved_game.is_in_battle == true) { GetSpawnScreen().MakeGoTo(); SaveManager.current_saved_game.is_in_battle = false; PlayerExploration.instance.transform.position = GetSpawnPoint().position; } else { PlayerExploration.instance.transform.position = SaveManager.current_saved_game.player_position; ExplorationScreenManager.instance.IndexToExplorationScreen(SaveManager.current_saved_game.current_exploration_screen_index).MakeGoTo(); } Player.instance.current_life = SaveManager.current_saved_game.current_life; Player.instance.base_shield = SaveManager.current_saved_game.base_shield; Player.instance.base_element_affinities = SaveManager.current_saved_game.base_element_affinities; Player.instance.current_karma = SaveManager.current_saved_game.current_karma; Player.instance.current_moster = MostersManager.instance.IndexToMosterData(SaveManager.current_saved_game.current_moster_index); Player.instance.time_lived = SaveManager.current_saved_game.time_lived; MostersManager.instance.eliminated_mosters_list = new List <MosterData>(); foreach (var moster_index in SaveManager.current_saved_game.eliminated_mosters_list) { MosterData moster_data = MostersManager.instance.IndexToMosterData(moster_index); MostersManager.instance.eliminated_mosters_list.Add(moster_data); // moster_data.moster_exploration.gameObject.SetActive(false); } MostersManager.instance.eliminated_dark_mosters_list = new List <MosterData>(); foreach (var moster_index in SaveManager.current_saved_game.eliminated_dark_mosters_list) { MosterData moster_data = MostersManager.instance.IndexToMosterData(moster_index); MostersManager.instance.eliminated_dark_mosters_list.Add(moster_data); // moster_data.moster_exploration.gameObject.SetActive(false); } MostersManager.instance.evolved_mosters_list = new List <MosterData>(); foreach (var moster_index in SaveManager.current_saved_game.evolved_mosters_list) { MostersManager.instance.evolved_mosters_list.Add(MostersManager.instance.IndexToMosterData(moster_index)); } for (int i = 0; i != SaveManager.current_saved_game.pickup_karmic_point_state_list.Count; ++i) { if (SaveManager.current_saved_game.pickup_karmic_point_state_list[i] == false) { PickupKarmicPointManager.instance.pickup_karma_list[i].Destroy(); } } }
IEnumerator Coroutine_CheckEvolutions() { while (true) { float current_check_time = 0f; while (current_check_time < _evolution_check_total_time) { yield return(new WaitForSeconds(_evolution_check_time_increment)); if (can_check_evolution == true) { current_check_time += _evolution_check_time_increment; } } MosterData moster_data_to_evolve_to = GetMosterWithHighestEvolutionScore(); if (moster_data_to_evolve_to != null) { yield return(StartCoroutine(Player.instance.Coroutine_EvolutionScene(moster_data_to_evolve_to))); } } }
public int MosterDataToIndex(MosterData moster) { return(mosters_list.IndexOf(moster)); }
public bool WasEvolvedTo(MosterData moster) { return(evolved_mosters_list.Contains(moster)); }
public bool IsEliminatedDark(MosterData moster) { return(eliminated_dark_mosters_list.Contains(moster)); }
public void EvolveTo(MosterData new_moster) { StartCoroutine(Coroutine_EvolutionScene(new_moster)); }
public void ApplyEvolutionChanges(MosterData new_moster) { current_life += new_moster.life_bonus; current_moster = new_moster; RefreshMoster(); }