public void RotatePlayer(Vector2 direction) { Rotater2D.LookAt(transform, transform.position + (Vector3)direction); }
IEnumerator Coroutine_StartBattle() { SoundManager.instance.PlayIndependant(SoundManager.instance.battle_start_sound); SoundManager.instance.PlayIfDifferent(enemy_moster.battle_theme); Vector3 previous_position = CameraManager.instance.exploration_camera.transform.position; Vector3 dest_camera_position = (enemy_moster.moster_data.moster_exploration.main_renderer.transform.position + PlayerExploration.instance.main_renderer.transform.position) / 2; dest_camera_position.z = previous_position.z; float initial_exploration_camera_size = CameraManager.instance.exploration_camera.orthographicSize; Debug.LogWarning("init size: " + initial_exploration_camera_size); CameraManager.instance.SetColorToFadePlane(Color.white); yield return(StartCoroutine(Coroutine_IntroBattleExplorationFlash())); TweenPosition.Begin(CameraManager.instance.exploration_camera.gameObject, intro_battle_exploration_time / 2, dest_camera_position); StartCoroutine(CameraManager.instance.COROUTINE_LaunchExplorationCameraStartBattleAnimation(intro_battle_exploration_time / 2 - 0.1f)); yield return(StartCoroutine(CameraManager.instance.COROUTINE_MainCameraFadeToOpaque(intro_battle_exploration_time / 2 + 0.1f))); //ExplorationIntro finished foreach (var defense_FX in defenses_FX) { defense_FX.Stop(); } foreach (var attack_FX in attacks_FX) { attack_FX.Stop(); } enemy_moster.SetupForBattle(); PlayerBattle.instance.SetupForBattle(); BattleScreen.instance.SetupForBattle(); if (regular_enemy_routine == true) { StartCoroutine(Coroutine_EnemyLoop()); } StateManager.instance.current_states.Remove(StateManager.State.EXPLORATION); StateManager.instance.current_states.Remove(StateManager.State.SCRIPTED_EVENT); StateManager.instance.current_states.Remove(StateManager.State.BATTLE_INTRO); StateManager.instance.current_states.Add(StateManager.State.BATTLE); StateManager.instance.UpdateFromStates(); PlayerBattle.instance.visuals_transform.position = player_visual_transform.position; Rotater2D.LookAt(PlayerBattle.instance.visuals_transform, player_visual_transform.position + Vector3.left); enemy_moster.visuals_transform.position = enemy_visual_transform.position; Rotater2D.LookAt(enemy_moster.visuals_transform, enemy_visual_transform.position + Vector3.right); //BattleIntroStarting // float initial_battle_camera_size = CameraManager.instance.battle_camera.orthographicSize; //BattleIntro finished //ExplorationIntro cleanup yield return(new WaitForSeconds(0.1f)); CameraManager.instance.exploration_camera.orthographicSize = initial_exploration_camera_size; CameraManager.instance.exploration_camera.transform.position = previous_position; //START FADE IN yield return(StartCoroutine(CameraManager.instance.COROUTINE_MainCameraFadeToTransparent(intro_in_battle_time))); yield return(new WaitForSeconds(0.001f)); }