private void HitBallDelegate(Player player, Vector2 direction, float force, int id) { m_start = true; if (m_bombBall == null) { return; } bool checkIsHitArea = PlayerCollider.CheckInHitBallArea(m_bombBall.GetBallInstance().transform, player.Transform, player.PlayerData.m_radius, player.PlayerData.m_angle, player.BoxCollider); if (checkIsHitArea) { CameraControl.GetInstance().Trigger(); CameraControl.GetInstance().TriggerMask(); GameAudioModuel audioModuel = GameStart.GetInstance().AudioModuel; if (id == m_player.ID) { GameEventModuel meoduel = GameStart.GetInstance().EventModuel; meoduel.SendEvent(GameEventID.PLAYER_HIT_BALL, true, 0f); m_side = ESide.Player; m_contestData.AddIndex(); if (m_contestData != null && m_contestData.m_changeAudio && !m_change) { audioModuel.PlayBgAudio("BGM_tense"); m_change = true; } m_playerIndex++; m_playerIndex = Mathf.Clamp(m_playerIndex, 0, m_audioNameList.Count - 1); audioModuel.PlayAudio(m_audioNameList[m_playerIndex]); } else { m_side = ESide.AI; m_aiIndex++; m_aiIndex = Mathf.Clamp(m_aiIndex, 0, m_audioNameList.Count - 1); audioModuel.PlayAudio(m_audioNameList[m_aiIndex]); } if (m_bombBall != null) { ESide side = (id == m_player.ID) ? ESide.Player : ESide.AI; m_bombBall.SetVelocity(direction, force, side); m_bombBall.ChangeSide(side); } } }
public void SetBomBall(BombBall ball) { m_target = ball.GetBallInstance().transform; }
public override void EnterState() { GameEventModuel eventModuel = GameStart.GetInstance().EventModuel; eventModuel.RegisterEventListener(GameEventID.TRIGGER_GAME_EVENT, OnTriggerEffectStart); eventModuel.RegisterEventListener(GameEventID.END_GAME_EVENT, OnTriggerEffectEnd); m_contestData = new GameContestData(); GameObject ground = GameStart.GetInstance().ResModuel.LoadResources <GameObject>(EResourceType.Ground, "Ground"); ground = CommonFunc.Instantiate(ground); m_ground = CommonFunc.AddSingleComponent <Ground>(ground); GroundData groundData = new GroundData(); m_ground.InitGround(groundData); PlayerData playerData = new PlayerData(); m_player = new Player(1, playerData); m_player.InitPlayerAction(HitBallDelegate); GameObject go = new GameObject("Controller"); m_playerController = go.AddComponent <PlayerController>(); m_playerController.InitController(m_player); BallData ballData = new BallData(); m_bombBall = new BombBall(ballData, m_ground.BounceLine); m_bombBall.SetOutofRangeAction(GameBallOutofRange); m_bombBall.SetPosition(groundData.GetFireBallPoint(ESide.Player)); AIPlayerData aiData = new AIPlayerData(); m_ai = new Player(2, aiData); m_ai.Transform.rotation = Quaternion.Euler(new Vector3(0f, 0f, 180f)); m_ai.InitPlayerAction(HitBallDelegate); m_aiController = go.AddComponent <AIController>(); m_aiController.SetBomBall(m_bombBall); m_aiController.InitController(m_ai); m_effect = new GameEffect(); m_bombUI = GameStart.GetInstance().UIModuel.LoadResUI <GameBombUI>("BombUI"); GameAudioModuel audioModuel = GameStart.GetInstance().AudioModuel; List <string> list = new List <string> { "BGM_tense", "lerp", }; audioModuel.PreLoadAudio(list); audioModuel.StopAudio(); m_player.Target = m_bombBall.GetBallInstance().transform; m_ai.Target = m_bombBall.GetBallInstance().transform; m_playerBombTime = 0f; m_aiBombTime = 0f; m_playerTotalBombTime = 20f; m_aiTotalBombTime = 20f; m_start = false; m_end = false; m_change = false; }