public override void EnterState() { 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_palyer = new Player(1, playerData); m_palyer.InitPlayerAction(HitBallDelegate); GameObject go = new GameObject("Controller"); m_playerController = go.AddComponent <PlayerController>(); m_playerController.InitController(m_palyer); BallMechineData mechineData = new BallMechineData(); BallData ballData = new BallData(); m_ballMechine = new BallMechine(mechineData, ballData, m_ground.GetLeftPoint(), m_ground.GetRightPoint()); CoroutineTool.GetInstance().StartGameCoroutine(StartCoroutine()); }
public static CoroutineTool GetInstance() { if (m_instance == null) { GameObject go = new GameObject("CoroutineTool"); m_instance = go.AddComponent <CoroutineTool>(); } return(m_instance); }
void Start() { CoroutineTool.Init(this); #if UNITY_EDITOR GameTools.LoadAssetAtPath = UnityEditor.AssetDatabase.LoadAssetAtPath; PathUtil.activeBuildTarget = EditorUserBuildSettings.activeBuildTarget.ToString(); #else PathUtil.activeBuildTarget = Application.platform.ToString(); #endif StartCoroutine(StartGame()); }
public void ServieBall(Vector2 dir, float force) { if (m_instance != null) { m_instance.enabled = true; m_instance.PlayAnim(m_mechineData.m_servieBallAnim); } GameBall ball = CreateGameBall(); CoroutineTool.GetInstance().StartGameCoroutine(FireBall(ball, dir, force)); }
private void FireBall() { if (m_anim != null) { bool left = CheckTargetIsLeft(); EEntityState state = left ? EEntityState.HitFan : EEntityState.Hit; m_anim.PlayAnim(state); } CoroutineTool.GetInstance().StartCoroutine(StartHitBall()); // //动画事件触发 // HitBall(); }
private void HandleBallOutOfRangeAction(GameBall ball) { if (ball == null) { return; } ball.ResetVelocity(); ball.SetActive(false); m_ballList.Remove(ball); m_cacheBallList.Add(ball); m_fireBallIndex++; if (m_mechineData.m_fireBallCountOneRound < m_fireBallIndex) { m_instance.ServiceBall = null; CoroutineTool.GetInstance().StartCoroutine(StartFireBall()); m_fireBallIndex = 0; } }
public static IEnumerator Init() { Actor = new T_ActorMgr(); CoroutineTool.StartCoroutine((Actor.ReadConfig())); ActorRes = new T_ActorResMgr(); CoroutineTool.StartCoroutine((ActorRes.ReadConfig())); ActorWeapon = new T_ActorWeaponMgr(); CoroutineTool.StartCoroutine((ActorWeapon.ReadConfig())); Ai = new T_AiMgr(); CoroutineTool.StartCoroutine((Ai.ReadConfig())); Buff = new T_BuffMgr(); CoroutineTool.StartCoroutine((Buff.ReadConfig())); Drop = new T_DropMgr(); CoroutineTool.StartCoroutine((Drop.ReadConfig())); Effect = new T_EffectMgr(); CoroutineTool.StartCoroutine((Effect.ReadConfig())); Etc = new T_EtcMgr(); CoroutineTool.StartCoroutine((Etc.ReadConfig())); Fairy = new T_FairyMgr(); CoroutineTool.StartCoroutine((Fairy.ReadConfig())); FairyLevel = new T_FairyLevelMgr(); CoroutineTool.StartCoroutine((FairyLevel.ReadConfig())); FairyRank = new T_FairyRankMgr(); CoroutineTool.StartCoroutine((FairyRank.ReadConfig())); FairyRes = new T_FairyResMgr(); CoroutineTool.StartCoroutine((FairyRes.ReadConfig())); Formation = new T_FormationMgr(); CoroutineTool.StartCoroutine((Formation.ReadConfig())); Hair = new T_HairMgr(); CoroutineTool.StartCoroutine((Hair.ReadConfig())); HairColor = new T_HairColorMgr(); CoroutineTool.StartCoroutine((HairColor.ReadConfig())); Language = new T_LanguageMgr(); CoroutineTool.StartCoroutine((Language.ReadConfig())); Map = new T_MapMgr(); CoroutineTool.StartCoroutine((Map.ReadConfig())); MapPve = new T_MapPveMgr(); CoroutineTool.StartCoroutine((MapPve.ReadConfig())); MonsterGroup = new T_MonsterGroupMgr(); CoroutineTool.StartCoroutine((MonsterGroup.ReadConfig())); Skill = new T_SkillMgr(); CoroutineTool.StartCoroutine((Skill.ReadConfig())); SkillKey = new T_SkillKeyMgr(); CoroutineTool.StartCoroutine((SkillKey.ReadConfig())); SkillValue = new T_SkillValueMgr(); CoroutineTool.StartCoroutine((SkillValue.ReadConfig())); UIConfig = new T_UIConfigMgr(); CoroutineTool.StartCoroutine((UIConfig.ReadConfig())); yield return(null); }
public override void EnterState() { m_player.EndMove(); CoroutineTool.GetInstance().StartGameCoroutine(WaitForHitAnimEnd()); }
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_gameBall = new GameBall(ballData, m_ground.BounceLine); m_gameBall.SetOutofRangeAction(GameBallOutofRange); m_gameBall.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.SetGameBall(m_gameBall); m_aiController.InitController(m_ai); m_effect = new GameEffect(); m_contestUI = GameStart.GetInstance().UIModuel.LoadResUI <GameContestUI>("ContestPrefab"); CoroutineTool.GetInstance().StartCoroutine(SetUI()); GameAudioModuel audioModuel = GameStart.GetInstance().AudioModuel; List <string> list = new List <string> { "BGM_001", "BGM_002", "lerp", }; audioModuel.PreLoadAudio(list); audioModuel.StopAudio(); m_player.Target = m_gameBall.GetBallInstance().transform; m_ai.Target = m_gameBall.GetBallInstance().transform; m_change = false; }
private void OnDestroy() { _instance = null; }