Unity¤Ë´ØÏ¢¤¹¤ëµ­»ö¤Ç¤¹

°ìÄê¤Î»þ´Ö¤¬·Ð²á¤¹¤ë¤È¥¤¥Ù¥ó¥È½àÈ÷¤¬À°¤¦¥±¡¼¥¹


¡¡Á°²ó¤Î³¤­¤Ë¤Ê¤ê¤Þ¤¹¡£

¡¡UniTask¤ÈUniRx¤ò»ÈÍѤ·¤Æ Final Fantasy¤ÎATB¥²¡¼¥¸¤Î¤è¤¦¤Ê¡¢°ìÄê»þ´Ö¤¬·Ð²á¤¹¤ë¤È¥¤¥Ù¥ó¥È¤Î½àÈ÷¤¬À°¤¦¥·¥¹¥Æ¥à¤ò¼ÂÁõ¤¹¤ëÎã¤Ç¤¹¡£
¤³¤³¤Ç¤Ï¥Ü¥¿¥ó¤¬²¡¤»¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤Þ¤¹¡£


¡ã¼ÂÁõÆ°²è¡ä
Æ°²è¥Õ¥¡¥¤¥ë¤Ø¤Î¥ê¥ó¥¯


À߷פȳµÍ×


¡¡Model ¥¯¥é¥¹¤Î¥ê¥Õ¥¡¥¯¥¿¥ê¥ó¥°¤È¡¢¥¹¥È¥ê¡¼¥à¤Ë¤Ä¤¤¤Æ¤Î¾ÜºÙ¤ÊÀâÌÀ¤ò¹Ô¤¤¤Þ¤¹¡£
¤Þ¤¿¤½¤ì¤Ëȼ¤Ã¤¿ Presenter ¥¯¥é¥¹¤Î¥ê¥Õ¥¡¥¯¥¿¥ê¥ó¥°¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£

¡¡ºÇ¸å¤Ë View ¥¯¥é¥¹¤ÇÍøÍѤ·¤Æ¤¤¤ë
public IObservable<Unit> OnAttackButtonClick => attackButton.OnClickAsObservable() ¥×¥í¥Ñ¥Æ¥£¤ÎÀâÌÀ¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£
¡¡

Model ¥¯¥é¥¹¤Î¥ê¥Õ¥¡¥¯¥¿¥ê¥ó¥°


¡¡ATBModel_Mono ¤Ï MonoBehaviour ¤Ø¤ÎɳÉÕ¤±¤¬¤¢¤ë¤¿¤á¡¢¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î°Í¸´Ø·¸¤¬È¯À¸¤·¤Þ¤¹¡£

¡¡UniRx ¤Ç¤Ï MonoBehaviour ¤òÍøÍѤ·¤Ê¤¯¤Æ¤â Update ¥á¥½¥Ã¥É¤ÈƱ¤¸µ¡Ç½¤ò»ý¤Ä½èÍý¤ò¼ÂÁõ¤Ç¤­¤ë¤¿¤á¡¢
²¼µ­¤Î¤è¤¦¤Ê·Á¤Ç½èÍý¤ò¥ê¥Õ¥¡¥¯¥¿¥ê¥ó¥°¤¹¤ë¤³¤È¤Ç¤âµ¡Ç½¤·¤Þ¤¹¡£

¡¡¤½¤³¤Ç ATBModel_Mono ¥¯¥é¥¹¤ÎÂå¤ï¤ê¤Ë¡¢ MonoBehaviour ¤Î·Ñ¾µ¤Î¤Ê¤¤ Model ¥¯¥é¥¹¤È¤·¤Æ ATBModel ¥¯¥é¥¹¤ò¿·¤·¤¯ºîÀ®¤·¤Þ¤¹¡£


ATBModel


¡¡°ÊÁ°¤Î ATBModel_Mono ¥¯¥é¥¹¤ò½¤Àµ¤Ï¹Ô¤ï¤º¡¢¥¯¥é¥¹Ì¾¤òÊѤ¨¤Æ¿·¤·¤¯ºîÀ®¤·¤Æ¤¯¤À¤µ¤¤¡£
ºîÀ®¸å¡¢Î¾Êý¤Î¥¯¥é¥¹¤Î½èÍý¤òÈæ³Ó¤·¡¢¤É¤¦¤¤¤Ã¤¿Éôʬ¤¬°Û¤Ê¤Ã¤Æ¤¤¤ë¤Î¤«¤ò³Îǧ¤·¤Æ¡¢½èÍý¤ÎÍý²ò¤ò¿¼¤á¤ë¤³¤È¤ËÌòΩ¤Æ¤Æ¤¯¤À¤µ¤¤¡£


ATBModel.cs

<= ¥¯¥ê¥Ã¥¯¤¹¤ë¤È³«¤­¤Þ¤¹¡£



²òÀâ


¡¡MonoBehaviour ¤Î·Ñ¾µ¤¬¤Ê¤¯¤Ê¤ê¤Þ¤·¤¿¡£¤½¤Î¤¿¤á¤³¤Î¥¯¥é¥¹¤Ï new ¤·¤Æ¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®¤·¤ÆÍøÍѤ¹¤ë·Á¼°¤Ë¤Ê¤ê¤Þ¤¹¡£
¤Þ¤¿ SetTriggerATB ¥á¥½¥Ã¥É¤Ç¤Ï¤Ê¤¯¡¢¥³¥ó¥¹¥È¥é¥¯¥¿¥á¥½¥Ã¥É¤È¡¢¤½¤Î°ú¿ô¤òÍøÍѤ·¤Æ¥á¥ó¥ÐÊÑ¿ô¤Î½é´üÀßÄê¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£

¡¡MonoBehaviour ¤ÈɳÉÕ¤¤¤Æ¤¤¤¿ UpdateAsObservable ¥á¥½¥Ã¥É¤ÎÂå¤ï¤ê¤Ë¡¢ÀÅŪ¥á¥½¥Ã¥É¤Ç¤¢¤ë Observable.EveryUpdate ¥á¥½¥Ã¥É¤òÍøÍѤ¹¤ë¤³¤È¤ÇÂåÍѤ·¤Æ¤¤¤Þ¤¹¡£
¤³¤Á¤é¤Î¥á¥½¥Ã¥É¤Ï MonoBehaviour ¤Ë¤ÏɳÉÕ¤¤¤Æ¤¤¤Ê¤¤¥á¥½¥Ã¥É¤Ç¤¢¤ë¤¿¤á¡¢AddTo ¥á¥½¥Ã¥É¤Ë¤è¤ê¡¢¥é¥¤¥Õ¥µ¥¤¥¯¥ë¤ò´ÉÍý¤·¤Æ¤¤¤Þ¤¹¡£

¡¡¤Ê¤ª¡¢using UnityEngine; ¤ÎÀë¸À¤Ï¡¢ Time ¥¯¥é¥¹¤òÍøÍѤ¹¤ë¤¿¤á¤ËɬÍפǤ¹¡£



¡¡Observable.EveryUpdate() ¤Ë¤è¤ë¥¹¥È¥ê¡¼¥à¤Ï¡¢AddTo ¥á¥½¥Ã¥É¤òÍøÍѤ¹¤ë¤³¤È¤Ë¤è¤ê¡¢ºîÀ®¤ÈƱ»þ¤Ë CompositeDisposable¤Ë¼«Æ°Åª¤ËÄɲ䵤ì¤Þ¤¹¡£
¤³¤Î¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤¬ÇË´þ¤µ¤ì¤ë¤È¤­¤ËDispose¥á¥½¥Ã¥É¤¬¸Æ¤Ó½Ð¤µ¤ì¡¢¤½¤ì¤Ë¤è¤Ã¤ÆCompositeDisposable¤Ë´Þ¤Þ¤ì¤ëÁ´¤Æ¤Î¥¹¥È¥ê¡¼¥à¤¬¼«Æ°Åª¤Ë²òÊü¤µ¤ì¤Þ¤¹

¡¡¤³¤Î¤È¤­¡¢AddTo ¥á¥½¥Ã¥É¤Î°ú¿ô¤Ë¤Ï this ¤Ï½ñ¤±¤Þ¤»¤ó¡£
Íýͳ¤Ï MonoBehaviour ¤ò·Ñ¾µ¤·¤Æ¤¤¤Ê¤¤¤¿¤á¤Ç¤¹¡£

¡¡MonoBehaviour¤ÏComponent¤ò·Ñ¾µ¤·¤Æ¤ª¤ê¡¢Component¤ÏObject¤ò·Ñ¾µ¤·¤Æ¤¤¤Þ¤¹¡£
Object¤Ë¤ÏIDisposable¤¬¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤¿¤á¡¢MonoBehaviour¤ä¤½¤ÎÇÉÀ¸¥¯¥é¥¹¤Ç¤¢¤ë¥¹¥¯¥ê¥×¥È¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Ç¤âAddTo(this)¤¬ÍøÍѤǤ­¤Þ¤¹¡£

¡¡°ìÊý¡¢°ìÈÌŪ¤ÊC#¥¯¥é¥¹¤ÏIDisposable¤ò¼ÂÁõ¤·¤Æ¤¤¤Ê¤¤¤¿¤á¡¢this ¤È¤Ï½ñ¤±¤Þ¤»¤ó¡£
AddTo()¤ÎÌá¤êÃͤòÊÝ»ý¤¹¤ëCompositeDisposable¥ª¥Ö¥¸¥§¥¯¥È¤òÊÌÅÓºîÀ®¤·¤Æ¡¢¤½¤³¤Ë¥¹¥È¥ê¡¼¥à¤òÄɲ䷤Ƥ¤¤Þ¤¹¡£
¤½¤·¤Æ¡¢¤½¤ÎCompositeDisposable¥ª¥Ö¥¸¥§¥¯¥È¤ÏɬÍפ˱þ¤¸¤ÆÌÀ¼¨Åª¤ËDispose¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£


    private readonly CompositeDisposable disposables = new ();


        // ATB¤ò²óÉü¤¹¤ë¥¹¥È¥ê¡¼¥à
        Observable.EveryUpdate()
            .Where(_ => CurrentATB.Value < MaxATB)
            .Subscribe(_ => CurrentATB.Value += RecoveryRate * Time.deltaTime)
            .AddTo(disposables);  // ¥¹¥È¥ê¡¼¥à¤¬À¸À®¤µ¤ì¤¿»þ¤Ë¼«Æ°Åª¤Ë CompositeDisposable ¤ËÄɲÃ


    /// <summary>
    /// ¥ª¥Ö¥¸¥§¥¯¥È(¥¤¥ó¥¹¥¿¥ó¥¹)¤¬ÇË´þ¤µ¤ì¤ë¤È¤­¤ËCompositeDisposable¤ÎDispose¤â¸Æ¤Ó½Ð¤¹
    /// </summary>
    public void Dispose()
    {
        // Dispose ¥á¥½¥Ã¥É¤¬¸Æ¤Ð¤ì¤¿¤È¤­¤Ë¡¢CompositeDisposable ¤Ë´Þ¤Þ¤ì¤ëÁ´¤Æ¤Î¥¹¥È¥ê¡¼¥à¤¬¼«Æ°Åª¤Ë²òÊü
        disposables.Dispose();
    }

¡¡¥¯¥é¥¹¤¬ MonoBehaviour ¤ò·Ñ¾µ¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¢OnDestroy ¥á¥½¥Ã¥É¤¬ÍøÍѤǤ­¤Ê¤¤¤¿¤á¡¢
Âå¤ï¤ê¤Ë IDisposable ¤ò¼ÂÁõ¤·¡¢Dispose ¥á¥½¥Ã¥É¤Ç¥¹¥È¥ê¡¼¥à¤ò¼êÆ°¤Ç²òÊü¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£

¡¡º£²óÀë¸À¤ÇÍøÍѤ·¤Æ¤¤¤ë CompositeDisposable ¤Ï IDisposable ¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤ò¼ÂÁõ¤·¤Æ¤¤¤Þ¤¹¡£
Dispose() ¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤Ç¡¢ÊÝ»ý¤·¤Æ¤¤¤ëÁ´¤Æ¤Î IDisposable ¥ª¥Ö¥¸¥§¥¯¥È (¥¹¥È¥ê¡¼¥à) ¤òÇË´þ¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
¤½¤Î¤¿¤á¡¢CompositeDisposable ¤òÍøÍѤ¹¤ë¤³¤È¤Ç¡¢Ê£¿ô¤Î¥¹¥È¥ê¡¼¥à¤ò¤Þ¤È¤á¤Æ´ÉÍý¤¹¤ë¤³¤È¤¬¤Ç¤­¡¢´Êñ¤Ë°ì³ç¤Ç Dispose() ¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤¬¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£

¡¡½èÍý¤Îή¤ì¤È¤·¤Æ¤Ï¡¢Observable ¤Ë AddTo(disposables) ¤òÄɲ乤뤳¤È¤Ç¡¢¥¹¥È¥ê¡¼¥à¤¬À¸À®¤µ¤ì¤¿»þ¤Ë¼«Æ°Åª¤Ë CompositeDisposable ¤ËÄɲ䵤ì¤Þ¤¹¡£
¤½¤·¤Æ¡¢Dispose ¥á¥½¥Ã¥É¤¬¸Æ¤Ð¤ì¤¿¤È¤­¤Ë¡¢CompositeDisposable ¤Ë´Þ¤Þ¤ì¤ëÁ´¤Æ¤Î¥¹¥È¥ê¡¼¥à¤¬¼«Æ°Åª¤Ë²òÊü¤µ¤ì¤Þ¤¹¡£

¡¡¤½¤Î¤¿¤á¡¢ATBModel¥¯¥é¥¹¤Î¾ì¹ç¤Ï¡¢Dispose ¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤Ç¡¢AddTo(disposables) ¤ÇÅÐÏ¿¤µ¤ì¤¿¥¹¥È¥ê¡¼¥à¤ò¼êÆ°¤Ç²òÊü¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£



¡¡¤³¤Î¤è¤¦¤Ê½¤Àµ¤ò¹Ô¤¦¤È¡¢Presenter ¦¤Î Awake ¥á¥½¥Ã¥ÉÆâ¤Î½èÍý¤âÊѹ¹¤¬É¬ÍפǤ¹¡£
SetTriggerATB ¥á¥½¥Ã¥É¤ò¼Â¹Ô¤·¤Æ¤¤¤¿Éôʬ¤Ç¡¢Âå¤ï¤ê¤Ë Model ¤ò¥¤¥ó¥¹¥¿¥ó¥¹¤·¤Æ¥³¥ó¥¹¥È¥é¥¯¥¿¥á¥½¥Ã¥É¤Ë°ú¿ô¤òÅϤ¹¤è¤¦¤Ë¤·¤Æ¤¤¤Þ¤¹¡£


ATBPresenter


¡¡ATBModel ¤ò¥¤¥ó¥¹¥¿¥ó¥¹¤·¡¢¥³¥ó¥¹¥È¥é¥¯¥¿¤òÍøÍѤ·¤Æ ATBModel Æâ¤Î³ÆÊÑ¿ô¤Î½é´ü²½¤ò¹Ô¤¦½èÍý¤Ëºî¤êÊѤ¨¤Þ¤¹¡£


ATBPresenter.cs

<= ¥¯¥ê¥Ã¥¯¤¹¤ë¤È³«¤­¤Þ¤¹¡£



Æ°ºî¤Î³Îǧ¤ò¤¹¤ë

¡¡
¡¡¥ê¥Õ¥¡¥¯¥¿¥ê¥ó¥°¤¬½ªÎ»¤·¤Þ¤·¤¿¤Î¤Ç¡¢Æ°ºî¤ò³Îǧ¤·¤Þ¤¹¡£

¡¡ºÇ½é¤Ë ATBController ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ë¥¢¥¿¥Ã¥Á¤µ¤ì¤Æ¤¤¤ë ATBModel_Mono ¥¯¥é¥¹¤ò Remove ¤·¤Þ¤¹¡£


¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü





¡¡ATBModel ¥¯¥é¥¹¤Ï MonoBehaviour ¤Î·Ñ¾µ¤Î¤Ê¤¤¥¯¥é¥¹¤Ç¤¢¤ë¤¿¤á¡¢¥²¡¼¥à¼Â¹Ô»þ¤Ë Presenter ¤Ë¤è¤Ã¤Æ¥¤¥ó¥¹¥¿¥ó¥¹¤¬À¸À®¤µ¤ì¤ÆÍøÍѤǤ­¤ë¾õÂ֤ˤʤê¤Þ¤¹¡£

¡¡¤½¤Î¸å¥²¡¼¥à¤ò¼Â¹Ô¤·¤Æ¤¯¤À¤µ¤¤¡£
º£¤Þ¤Ç¤ÈƱ¤¸¤è¤¦¤Ë¥²¡¼¥¸¤¬Î¯¤Þ¤ê¡¢¥Ü¥¿¥ó¤¬²¡¤»¡¢ºÆÅÙ¡¢¥²¡¼¥¸¤¬Î¯¤Þ¤ë¤È¤¤¤¦¥µ¥¤¥¯¥ë¤¬Æ°¤¤¤Æ¤¤¤ë¤«¤ò³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£


View ¥¯¥é¥¹¤Î Button ¤ò³°Éô¥¯¥é¥¹¤ÇľÀܹØÆɤµ¤»¤Ê¤¤¼êË¡


¡¡View ¥¯¥é¥¹¤Ë¤Ï OnAttackButtonClick ¥×¥í¥Ñ¥Æ¥£¤òÍÑ°Õ¤·¤Æ¤¤¤Þ¤¹¡£
¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ò Subscribe ¤¹¤ë¤³¤È¤Ç¡¢³°Éô¥¯¥é¥¹¤Ç¤â¥Ü¥¿¥ó¤Î¥¯¥ê¥Ã¥¯¥¤¥Ù¥ó¥È¤ò¸¡ÃΤ¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£

¡¡¤³¤Î¤è¤¦¤ÊÀ߷פˤ¹¤ë¤³¤È¤Ç¡¢¥Ü¥¿¥ó¤Î¥¯¥ê¥Ã¥¯¤Ë¤è¤Ã¤Æ¼Â¹Ô¤µ¤ì¤ëÆâÉôŪ¤Ê½èÍý¤òÈëÆ¿¤·¤¿¤Þ¤Þ¡¢
³°Éô¥¯¥é¥¹¤Ë¤ª¤¤¤Æ¤Ï¡¢¥¤¥Ù¥ó¥È¤ò¸¡ÃΤ·¤¿¤³¤È¤òÍøÍѤ·¤¿½èÍý¤ò½ñ¤¯¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£


ATBView


¡¡Ê¸¾Ï¤Î¤ß¤Ç¤ÏÆñ¤·¤¤¤¿¤á¡¢¶ñÂÎŪ¤Ê½èÍý¤òÄ󼨤·¤Þ¤¹¡£

¡¡¤Þ¤º¡¢¤³¤Î OnAttackButtonClick ¥×¥í¥Ñ¥Æ¥£¤ò»È¤ï¤Ê¤¤ÊýË¡¤ò¸«¤Æ¤¤¤­¤Þ¤¹¡£


ATBView.cs

<= ¥¯¥ê¥Ã¥¯¤¹¤ë¤È³«¤­¤Þ¤¹¡£


¡¡Button ¤Î¾ðÊó¤ò¼èÆÀ¤¹¤ë¤¿¤á¤Ë GetAttackButton ¥á¥½¥Ã¥É¤¬¥²¥Ã¥¿¡¼¥á¥½¥Ã¥É¤È¤·¤ÆÍÑ°Õ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£


ATBPresenter


¡¡¤³¤ÎÎã¤Ç¤Ï¡¢Start ¥á¥½¥Ã¥ÉÆâ¤Ç Button ¤Ë OnClickAsObservable ¤òºîÀ®¤·¡¢Subscribe ¤·¤Æ¥¯¥ê¥Ã¥¯¥¤¥Ù¥ó¥È¤òºîÀ®¤·¤Æ¤¤¤Þ¤¹¡£
¤½¤Î¤¿¤á¡¢¤³¤Î¥¯¥é¥¹°Ê³°¤Î³°Éô¥¯¥é¥¹¤Ç¤Ï¡¢¥¯¥ê¥Ã¥¯¥¤¥Ù¥ó¥È¤ò´¶ÃΤ¹¤ë¼êÃʤ¬¤¢¤ê¤Þ¤»¤ó¡£

¡¡¤½¤¦¤Ê¤Ã¤¿¤È¤­¤ËÍøÍѤ¹¤ëÊýË¡¤¬¡¢Button ¼«ÂΤò public ¤Ë¤¹¤ë¤«¡¢¥×¥í¥Ñ¥Æ¥£¤ä GetAttackButton ¤Î¤è¤¦¤Ê¥²¥Ã¥¿¡¼¥á¥½¥Ã¥É¤òºîÀ®¤·¤Æ¤ª¤¤¤Æ¡¢
³°Éô¥¯¥é¥¹¤Ë¤ª¤¤¤Æ¡¢Ä¾ÀÜ Button ¤Ë¥¢¥¯¥»¥¹¤ò¹Ô¤¤¡¢¥¯¥ê¥Ã¥¯¥¤¥Ù¥ó¥È¤ò³°Éô¥¯¥é¥¹¤ÇºîÀ®¤¹¤ë¥Ñ¥¿¡¼¥ó¤Ç¤¹¡£

¡¡²¼µ­¤Î¤è¤¦¤Ê¤â¤Î¤Ë¤Ê¤ê¤Þ¤¹¡£


ATBPresenter.cs

<= ¥¯¥ê¥Ã¥¯¤¹¤ë¤È³«¤­¤Þ¤¹¡£


¡¡¤É¤Á¤é¤Î¥Ñ¥¿¡¼¥ó¤òÍøÍѤ·¤¿¾ì¹ç¤Ç¤â¡¢Button ¤Ï»²¾È¤µ¤ì¤ë¤À¤±¤Ç¤Ï¤Ê¤¯¡¢¹ØÆɤνèÍý¤â¹Ô¤¦¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
¤³¤Î¼ÂÁõÊýË¡¤Ç¤¹¤È¥¯¥é¥¹¤ÎÁ·ë¹ç²½¤¬¤Ç¤­¤Æ¤ª¤é¤º¡¢¹ØÆɽèÍý¤Î½¤Àµ¤ò¹Ô¤¦¤È¡¢View ¥¯¥é¥¹¤Ë¤â±Æ¶Á¤¬½Ð¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¤¤Þ¤¹¡£

¡¡¤³¤¦¤¤¤Ã¤¿¥±¡¼¥¹¤Ï¤Ê¤ë¤Ù¤¯Èò¤±¤¿Êý¤¬¤è¤¤¤Ç¤¹¡£


ATBView ²þÁ±°Æ


¡¡¤³¤ÎÊýË¡¤ò²óÈò¤¹¤ë¼êÃʤȤ·¤Æ¡¢View ¥¯¥é¥¹Æâ¤Ë¤¢¤ë OnAttackButtonClick ¥×¥í¥Ñ¥Æ¥£¤òÍøÍѤ·¤Þ¤¹¡£
¤³¤ì¤¬º£²óÀâÌÀ¤·¤Æ¤¤¤ë¡¢¥¯¥é¥¹ÆâÉô¤Î½èÍý¤ÏÈëÆ¿¤·¤¿¤Þ¤Þ¡¢³°Éô¥¯¥é¥¹¤Ë¥¯¥ê¥Ã¥¯¥¤¥Ù¥ó¥È¤òÄÌÃΤµ¤»¤ë¤¿¤á¤Îµ¡Ç½¤Ç¤¹¡£

¡¡²¼µ­¤Î¤è¤¦¤Ê¼ÂÁõ¤ò¹Ô¤¦¤³¤È¤Ç¡¢ATBView Æâ¤Î Button ¼«ÂΤÏÈëÆ¿(private ¤Î¤Þ¤Þ¤Ë)¤·¡¢OnClickAsObservable ¤Î Subscribe ½èÍý¤Ï¤³¤Î¥¯¥é¥¹¤Ç¹Ô¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
¤Þ¤¿¡¢OnClickAsObservable ¤ò Subscribe ¤¹¤ë½èÍý¤¬¤Ê¤¯¤Æ¤â¡¢¥¯¥ê¥Ã¥¯¥¤¥Ù¥ó¥È¤ò³°Éô¥¯¥é¥¹¤ËÄ󶡤Ǥ­¤ë¾å¡¢Subscribe ¤·¤¿ºÝ¤ÎÆâÍƤϳ°Éô¥¯¥é¥¹¤Ë¤Ï±Æ¶Á¤·¤Þ¤»¤ó¡£

¡¡¥¯¥ê¥Ã¥¯¤·¤¿¡¢¤È¤¤¤¦¥¤¥Ù¥ó¥È¤Î¤ß¤ò³°Éô¤«¤é»²¾È¤·¤Æ Subscribe ¤Ç¤­¤ë¡¢¤È¤¤¤¦Ìõ¤Ç¤¹¡£


ATBView.cs

<= ¥¯¥ê¥Ã¥¯¤¹¤ë¤È³«¤­¤Þ¤¹¡£


¡¡OnAttackButtonClick ¤Ï attackButton¤Î¥¯¥ê¥Ã¥¯¥¤¥Ù¥ó¥È¤ò´¶ÃΤ·¡¢³°Éô¥¯¥é¥¹¤ÇSubscribe¤µ¤ì¤¿»þ¤Ë¤½¤ÎÆâÍƤò¼Â¹Ô¤·¤Þ¤¹¡£

¡¡Start¥á¥½¥Ã¥É¤Ç¹Ô¤Ã¤Æ¤¤¤ëSubscribe¤ÎÆâÍƤϡ¢OnAttackButtonClick¤ËÂФ¹¤ëÆâÉôŪ¤Ê¼ÂÁõ¤Ç¤¢¤ê¡¢³°Éô¥¯¥é¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹¤³¤È¤Ï¤¢¤ê¤Þ¤»¤ó¡£
Subscribe¤µ¤ì¤ë¤Þ¤ÇÆâÉô¤ÇÊÝ»ý¤µ¤ì¡¢³°Éô¤«¤é¤ÏÈëÆ¿¤µ¤ì¤Þ¤¹¡£


ATBPresenter ²þÁ±°Æ


¡¡³°Éô¥¯¥é¥¹¤Ç¤¢¤ë View ¥¯¥é¥¹¤Î Button ¤Î¥¯¥ê¥Ã¥¯¥¤¥Ù¥ó¥È¤òľÀÜÌ¿Î᤻¤º¤Ë¡¢
OnAttackButtonClick ¥×¥í¥Ñ¥Æ¥£¤ò»È¤¦¤³¤È¤Ç¡¢¥¯¥ê¥Ã¥¯¥¤¥Ù¥ó¥È¤Î¤ß¤Î¹ØÆɤò¹Ô¤¦¤³¤È¤¬½ÐÍè¤Þ¤¹¡£

¡¡¸À¤¤´¹¤¨¤ë¤È¡¢Presenter ¦¤Ï¡¢Button ¤Ç¤¢¤ë¤«¤É¤¦¤«¤Ï´ØÍ¿¤»¤º(ÃΤé¤Ê¤¤¾õÂÖ)¡¢²¿¤é¤«¤Î¥¤¥Ù¥ó¥È¤ËÂФ·¤Æ¹ØÆɤò¹Ô¤¦¤È¤¤¤¦¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
Presenter ¤Ï OnAttackButtonClick ¥×¥í¥Ñ¥Æ¥£¤Î»²¾ÈÀè¤Þ¤Ç¤Ï¸«¤Æ¤¤¤Ê¤¤¤Î¤Ç¡¢Button ¤Ç¤¢¤ë¤«¤É¤¦¤«¤ÏÉÔÌä¤Î¾õÂ֤Ǥ¹¡£
¤³¤Î¤è¤¦¤Ë½èÍý¤òÃÖ¤­´¹¤¨¤ë¤³¤È¤Ç¡¢¤è¤ê½èÍý¤òÃê¾Ý²½¤·¤Æ¼ÂÁõ¤¹¤ë¤³¤È¤¬½ÐÍè¤Æ¤¤¤Þ¤¹¡£


ATBPresenter.cs

<= ¥¯¥ê¥Ã¥¯¤¹¤ë¤È³«¤­¤Þ¤¹¡£




¡¡view.OnAttackButtonClick ¤Ë¤è¤ê¡¢ATBView ¥¯¥é¥¹Æâ¤Ç¼ÂÁõ¤µ¤ì¤¿¹¶·â¥Ü¥¿¥ó¤Î¥¯¥ê¥Ã¥¯¥¤¥Ù¥ó¥È¤ò³°Éô¥¯¥é¥¹¤«¤éľÀÜ Subscribe ¤¹¤ëɬÍפ¬¤Ê¤¯¤Ê¤ê¡¢
ATBView ¥¯¥é¥¹¤Î¥×¥é¥¤¥Ù¡¼¥È¤Ê¼ÂÁõ¤Î¾ÜºÙ¤ò±£Ê乤뤳¤È¤¬¤Ç¤­¤Þ¤¹¡£¤Þ¤¿¡¢View ¥¯¥é¥¹¤Ë¤ª¤¤¤Æ OnClickAsObservable ¤ÎÍøÍÑ̵ͭ¤Ë¤«¤«¤ï¤é¤º¡¢¥¯¥ê¥Ã¥¯¥¤¥Ù¥ó¥È¤ò´¶ÃΤǤ­¤Þ¤¹¡£

¡¡¤³¤ì¤Ë¤è¤ê ATBView ¥¯¥é¥¹¤Î¼ÂÁõ¤òÊѹ¹¤¹¤ë¤³¤È¤¬¤Ç¤­¡¢¤½¤ì¤Ë¤è¤Ã¤Æ³°Éô¥¯¥é¥¹¤Î½èÍý¤Ë±Æ¶Á¤òÍ¿¤¨¤ë¤³¤È¤¬¤Ê¤¯¡¢¥³¡¼¥É¤ÎÊݼéÀ­¤¬¸þ¾å¤·¤Þ¤¹¡£
¤Þ¤¿¡¢¤³¤ÎÊýË¡¤Ë¤è¤ê¡¢³°Éô¥¯¥é¥¹¤¬ ATBView ¥¯¥é¥¹¤Ë°Í¸¤¹¤ë¤³¤È¤¬¾¯¤Ê¤¯¤Ê¤ê¡¢Á·ë¹ç²½¤¬Â¥¿Ê¤µ¤ì¤Þ¤¹¡£

¡¡Å¬Àڤʥץí¥Ñ¥Æ¥£¤òºîÀ®¤·¤ÆÍøÍѤ¹¤ë¤³¤È¤Ë¤è¤ê¡¢¥«¥×¥»¥ë²½¤ÈÁ·ë¹ç²½¤ËÌòΩ¤Á¤Þ¤¹¡£



¡¡°Ê¾å¤Ë¤Ê¤ê¤Þ¤¹¡£

¡¡MVP ¥Ñ¥¿¡¼¥ó¤Î¼ÂÁõ¤Ë¤Ä¤¤¤Æ¤Ï¡¢Presenter ¤Ç¹Ô¤¦¹ØÆɽèÍý¤ò¤É¤Î¤è¤¦¤Ë¤·¤Æ¹Ô¤¦¤«¤ò¹Í¤¨¤ÆÀ߷פ¹¤ë¤È¡¢¤è¤ê¤è¤¤¥³¡¼¥Ç¥£¥ó¥°¤¬¹Ô¤¨¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£

¥³¥á¥ó¥È¤ò¤«¤¯


¡Öhttp://¡×¤ò´Þ¤àÅê¹Æ¤Ï¶Ø»ß¤µ¤ì¤Æ¤¤¤Þ¤¹¡£

ÍøÍѵ¬Ìó¤ò¤´³Îǧ¤Î¤¦¤¨¤´µ­Æþ²¼¤µ¤¤

Menu


´ðÁÃ

µ»½Ñ/Ãμ±(¼ÂÁõÎã)

3D¥¢¥¯¥·¥ç¥ó¥²¡¼¥à

2D¤ª¤Ï¤¸¤­¥²¡¼¥à(ȯŸÊÔ)

2D¶¯À©²£¥¹¥¯¥í¡¼¥ë¥¢¥¯¥·¥ç¥ó(ȯŸÊÔ)

2D¥¿¥Ã¥×¥·¥å¡¼¥Æ¥£¥ó¥°(³ÈÄ¥ÊÔ)

¥ì¡¼¥¹¥²¡¼¥à(È´¿è)

2DÊüÃÖ¥²¡¼¥à(ȯŸÊÔ)

3D¥ì¡¼¥ë¥¬¥ó¥·¥å¡¼¥Æ¥£¥ó¥°(±þÍÑÊÔ)

3Dæ½Ð¥²¡¼¥à(È´¿è)

2D¥ê¥¢¥ë¥¿¥¤¥à¥¹¥È¥é¥Æ¥¸¡¼

3D¥¿¥Ã¥×¥¢¥¯¥·¥ç¥ó(NavMeshAgent »ÈÍÑ)

2D¥È¥Ã¥×¥Ó¥å¡¼¥¢¥¯¥·¥ç¥ó(¥«¥¨¥ë¤Î°Ù¤Ë¡Á¡¢¥Ü¥³¥¹¥«¥¦¥©¡¼¥ºÉ÷)

VideoPlayer ¥¤¥Ù¥ó¥ÈϢư¤Î¼ÂÁõÎã

VideoPlayer ¥ê¥¹¥ÈÆ⤫¤é¥à¡¼¥Ó¡¼ºÆÀ¸¤Î¼ÂÁõÎã(ȯŸ)

AR ²èÁüÉÕ¤­¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À®¤Î¼ÂÁõÎã

AR ¥ê¥¹¥ÈÆ⤫¤éÀ¸À®¤Î¼ÂÁõÎã(ȯŸ)

2D¥È¥Ã¥×¥Ó¥å¡¼¥¢¥¯¥·¥ç¥ó(¥µ¥Ð¥¤¥Ð¡¼É÷)

private



¤³¤Î¥µ¥¤¥ÈÆâ¤ÎºîÉʤϥæ¥Ë¥Æ¥£¤Á¤ã¤ó¥é¥¤¥»¥ó¥¹¾ò¹à¤Î¸µ¤ËÄ󶡤µ¤ì¤Æ¤¤¤Þ¤¹¡£

´ÉÍý¿Í/Éû´ÉÍý¿Í¤Î¤ßÊÔ½¸¤Ç¤­¤Þ¤¹