コード例 #1
0
    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());
    }
コード例 #2
0
 public static GameStart GetInstance()
 {
     if (m_instance == null)
     {
         GameObject gameObj = new GameObject("GameStart");
         gameObj.SetTransformZero();
         DontDestroyOnLoad(gameObj);
         m_instance = CommonFunc.AddSingleComponent <GameStart>(gameObj);
     }
     return(m_instance);
 }
コード例 #3
0
ファイル: PlayerAnim.cs プロジェクト: LeoguoEx/miniTennis
    public PlayerAnim(GameObject gameObject)
    {
        if (gameObject == null)
        {
            return;
        }

        GameObject player = CommonFunc.GetChild(gameObject, CHARACTER);

        m_animator = CommonFunc.AddSingleComponent <Animator>(player);
    }
コード例 #4
0
    public override void EnterState()
    {
        GameEventModuel eventModuel = GameStart.GetInstance().EventModuel;

        eventModuel.RegisterEventListener(GameEventID.Reset_Game_State, HandleResetStateEvent);
        eventModuel.RegisterEventListener(GameEventID.ENTITY_HIT_BALL, HandleEntityHitBall);

        GameObject ball = GameObject.Find("Ball");

        if (ball != null)
        {
            m_ball = CommonFunc.AddSingleComponent <Ball>(ball);
            m_ball.Reset();
        }

        GameObject chracter = GameObject.Find("Character");

        if (chracter != null)
        {
            m_entityInstance = chracter.GetComponent <EntityInstance>();

            Vector4 moveRange = new Vector4(-1.73f, -0.81f, 3.15f, -5.4f);
            m_entityInstance.SetMoveRange(moveRange);
        }


        GameObject ai = GameObject.Find("AI");

        if (ai != null)
        {
            m_aiInstance = ai.GetComponent <EntityInstance>();
            Vector4 moveRange = new Vector4(-2.09f, 9.3f, 2.61f, 4.61f);
            m_aiInstance.SetMoveRange(moveRange);
            ai.AddComponent <AIStateController>();
        }

        GameDataModuel dataModuel = GameStart.GetInstance().DataModuel;

        dataModuel.SetGameData(3, 0);

        m_ui = GameObject.FindObjectOfType <GameTestStateUI>();
        if (m_ui != null)
        {
            m_ui.Init();
        }
    }
コード例 #5
0
    void Start()
    {
        m_characterAnim     = new CharacterAnim(gameObject);
        m_characterCollider = gameObject.GetComponent <CharacterCollider>();
        GameObject bat = CommonFunc.GetChild(gameObject, "Bat");

        m_batCollider      = CommonFunc.AddSingleComponent <CharacterCollider>(bat);
        m_characterControl = gameObject.GetComponentInChildren <CharacterControl>();
        if (m_characterControl != null)
        {
            m_characterControl.SwitchState      = Switch;
            m_characterControl.MoveEntityAction = SetMovePosition;
            m_characterControl.SetMoveEntity(gameObject);
        }

        if (m_characterAnim != null)
        {
            m_characterAnim.PlayAnim(EEntityState.Idle);
        }

        m_startPosition = transform.position;
    }
コード例 #6
0
 public CharacterAnim(GameObject go)
 {
     m_animator = CommonFunc.AddSingleComponent <Animator>(go);
 }
コード例 #7
0
 void Start()
 {
     FingerDownDetector downDetector = CommonFunc.AddSingleComponent <FingerDownDetector>(gameObject);
     FingerUpDetector   upDetector   = CommonFunc.AddSingleComponent <FingerUpDetector>(gameObject);
 }
コード例 #8
0
    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;
    }