コード例 #1
0
    private void Start()
    {
        PlayerInfo.Instance.SetPlayCount(PlayerInfo.Instance.GetPlayCount() + 1);
        bool isReverse = PlayerInfo.Instance.GetIsReverse();

        buttonController.ChangeButtonPosition(isReverse);

        Character character = inGameCharacterFactory.GetCharacter();

        characterController.character = character;

        Invoke("AddClickEventMoveButton", 1.0f);


        InGameEventService.Instance.hitCharacterEvent += hpController.DecreaseHP;
        InGameEventService.Instance.hitCharacterEvent += characterController.PlayHit;
        int hp = characterController.character.GetComponent <Character>().GetHP();

        hpController.SetHP(hp);

        InGameEventService.Instance.enterGroundEvent += SetEnableButtonTrue;
        InGameEventService.Instance.enterGroundEvent += characterController.PlayIdle;

        InGameEventService.Instance.dieCharacterEvent += () =>
        {
            int ad = Random.Range(0, 10);
            if (ad > 0)
            {
                AdsService.Instance.ShowAd();
            }

            VibrateManager.Instance.PlayVibration();
            grave.StartActive();
            characterController.character.gameObject.SetActive(false);
            int bestScore = PlayerInfo.Instance.GetBestScore();
            int score     = scoreController.getScoreValue();
            resultController.ShowResultPopup(bestScore, score);
        };

        InGameEventService.Instance.cameraShake += cameraShake.StartShake;
    }
コード例 #2
0
 /// <summary>
 /// 血量改变
 /// </summary>
 public void OnHPChange()
 {
     hpController.SetHP((float)Model.CurrentHP / Model.MaxHP);
 }