Slide 1

Slide 1 text

גࣜձࣾΩοζελʔ CTO ৿ɹ఩࠸ ͞Β͹ίʔυʂ Clean Architecture Λ
 Ϛελʔͯ࣍͠ੈ୅ͷ
 Unity ΤϯδχΞʹͳΖ͏ʂ ABC 2018s @ 2018/06/09

Slide 2

Slide 2 text

2 ͜Μʹͪ͸ʂ

Slide 3

Slide 3 text

3 ಥવͰ͕͢ɺ ͜Μͳίʔυॻ͍ͯ·ͤΜ͔ʁ

Slide 4

Slide 4 text

4 ωετͷਂ͍ Update(), FixedUpdate()

Slide 5

Slide 5 text

5 1,000ߦΛ௒͑Δ GameManager.cs

Slide 6

Slide 6 text

6 SingletonMonoBehaviour Λ ܧঝͨ͠େྔͷ Manager Ϋϥε

Slide 7

Slide 7 text

7 ςετίʔυ͕1ߦ΋ ଘࡏ͠ͳ͍ϓϩδΣΫτ

Slide 8

Slide 8 text

8 ࠓ೔͸

Slide 9

Slide 9 text

9 ͜Μͳ…

Slide 10

Slide 10 text

10 ͳϓϩδΣΫτΛ ͳϓϩδΣΫτ΁ ੜ·ΕมΘΒͤΔํ๏

Slide 11

Slide 11 text

11 ʹ͍͓ͭͯ࿩͠͠·͢

Slide 12

Slide 12 text

ࣗݾ঺հ 12

Slide 13

Slide 13 text

w৿ɹ఩࠸ʢBLB΋ΜΓ͌ઌੜʣ w೥࡛ۄݝ࢈ wגࣜձࣾΩοζελʔ$50 wࡀϲ݄ͷ່ʹκοίϯ-07& w͓ञͱ߹এͱϓϩάϥϛϯά͕झຯ w5XJUUFS!NPOSZ(JU)VC!NPOSZ 13 Who am I ?

Slide 14

Slide 14 text

w ࢠͲ΋޲͚εϚϗΞϓϦ
 ։ൃͳͲ w ೥͋ͨΓ͔Β
 6OJUZΨοπϦ w ͬ͜͝ϥϯυ
 ྦྷܭສ%- w "QQ4UPSF(PPHMF1MBZ
 ʹͯࢠͲ΋޲͚ΧςΰϦ
 ϥϯΩϯά501 14 ͓͠͝ͱ

Slide 15

Slide 15 text

ΞδΣϯμ 15

Slide 16

Slide 16 text

w6OJUZ։ൃ͋Δ͋Δ wີ݁߹ˠૄ݁߹ w$MFBO"SDIJUFDUVSFʹ͍ͭͯ w$"'6ʹ͍ͭͯ 16 ͓͠ͳ͕͖

Slide 17

Slide 17 text

w6OJUZ։ൃ͋Δ͋Δ wີ݁߹ˠૄ݁߹ w$MFBO"SDIJUFDUVSFʹ͍ͭͯ w$"'6ʹ͍ͭͯ 17 ͓͠ͳ͕͖

Slide 18

Slide 18 text

Unity ։ൃ͋Δ͋Δ 18

Slide 19

Slide 19 text

wʮ͜ͷίϯϙʔωϯτमਖ਼͠Αʯ wʮ͑ͬͱɺ͜ͷJGͷதͷGPSFBDI
 ͷதͷFMTFJGͷதͷʜʯ wʮ͜ͷதׅހɺͲ͜ͷ৚݅ͩʜʁʯ wˠ௒ωετ͕ਂ͍6QEBUF 19 ͋Δ͋Δݴ͍͍ͨ Unity ։ൃ͋Δ͋Δ

Slide 20

Slide 20 text

wʮήʔϜͷϩδοΫΛڞ௨Խ͢ΔͰʯ wʮ͜ͷॲཧ΋ڞ௨Խ͢ΔͰʯ wʮ͜Ε΋ɺ͋Ε΋ʜɻʯ wˠ ߦΛ௒͢(BNF.BOBHFSDT 20 ͋Δ͋Δݴ͍͍ͨ Unity ։ൃ͋Δ͋Δ

Slide 21

Slide 21 text

wʮ͜ͷίϯϙʔωϯτ͸ɺͲ͜ͷγʔ ϯ͔ΒͰ΋ࢀর͍ͨ͠ʯ wʮ΄͏ɺDontDestroyOnLoadͱͳʯ wˠ4JOHMFUPO.POP#FIBWJPVSྔ࢈ 21 ͋Δ͋Δݴ͍͍ͨ Unity ։ൃ͋Δ͋Δ

Slide 22

Slide 22 text

wʮ6OJUZ5FTU5PPMT࢖͏ͧʔʯ wʮ͜ͷϝιουςετ͢Δʹ͸ɺ
 ͜ͷΫϥεΛॳظԽͯ͠ɺ͜ͷΫϥεΛ
 ॳظԽ͢Δʹ͸ผͷγʔϯͷΫϥε͕
 ඞཁͰʜɻʯ wˠςετಋೖ࠳ં 22 ͋Δ͋Δݴ͍͍ͨ Unity ։ൃ͋Δ͋Δ

Slide 23

Slide 23 text

wQVCMJDͱ͔<4FSJBMJ[F'JFME>ʹΑΓ
 ෳࡶʹབྷΈ߹͏.POP#FIBWJPVS wαʔόଆͷσʔλߏ଄มߋͷ
 Өڹൣғ͕ਙେ w4DSJQUBCMF0CKFDU࿔ͬͨΒϩʔΧϧʹ
 อଘͯ͠ΔσʔλϑΝΠϧ͕յΕͨ 23 ଞʹ΋… Unity ։ൃ͋Δ͋Δ

Slide 24

Slide 24 text

wϩδοΫͷڞ௨ԽΛਤΖ͏ͱ͢Δ͕
 γʔϯຖͷඍົͳࠩҟΛٵऩ͖͠Εͣ
 େྔͷҾ਺ͱ৚݅෼ذ͕ൃੜ wσʔλͷఏڙݩຖʹσʔλߏ଄ఆٛ
 Ϋϥε͕ྔ࢈͞ΕΔ 24 ଞʹ΋… Unity ։ൃ͋Δ͋Δ

Slide 25

Slide 25 text

25 ͜͏͍͏ঢ়ଶ

Slide 26

Slide 26 text

26 is

Slide 27

Slide 27 text

27 ີ݁߹

Slide 28

Slide 28 text

28 ີ݁߹

Slide 29

Slide 29 text

29 ີ݁߹

Slide 30

Slide 30 text

30

Slide 31

Slide 31 text

w6OJUZ։ൃ͋Δ͋Δ wີ݁߹ˠૄ݁߹ w$MFBO"SDIJUFDUVSFʹ͍ͭͯ w$"'6ʹ͍ͭͯ 31 ͓͠ͳ͕͖

Slide 32

Slide 32 text

ີ݁߹→ૄ݁߹ 32

Slide 33

Slide 33 text

wมߋʹରͯ͠੬ऑ wͦ΋ͦ΋มߋ͠ਏ͍ wӨڹൣғɾ੹೚ൣғ͕ෆ໌ྎ wଞਓ͕ಡΈਏ͍ wϲ݄લͷࣗ෼͸ଞਓͰ͢ 33 ີ݁߹͸Կނʁ ີ݁߹→ૄ݁߹

Slide 34

Slide 34 text

w૯ͯ͡ɺϝϯςφϯεੑ͕௿͍ wٯʹϝϯςφϯεΛཁ͠ͳ͍
 ϓϩμΫτͰ͋Ε͹ɺΨοͱ
 ີ݁߹ͳίʔυͰૉૣ͘ॻ͘ͷ΋ΞϦ 34 ີ݁߹͸Կނʁ ີ݁߹→ૄ݁߹

Slide 35

Slide 35 text

w͋ΔΫϥεͷमਖ਼͕ଞͷΫϥεʹٴ͹ ͳ͍ wΫϥεͷ੹೚͕໌֬Ͱςετ͕ॻ͖΍ ͍͢ w֦ு͕͠қ͍ 35 ૄ݁߹͸Կނʁ ີ݁߹→ૄ݁߹

Slide 36

Slide 36 text

w૯ͯ͡ɺϝϯςφϯεੑ͕ߴ͍ wճҎ্ϝϯςφϯεʢमਖ਼ʣΛ
 ߦ͏ϓϩμΫτͰ͋Ε͹ɺ
 ϝϯςφϯεੑͷߴ͕͞Ձ஋ʹܨ͕Δ 36 ૄ݁߹͸Կނʁ ີ݁߹→ૄ݁߹

Slide 37

Slide 37 text

37 How to ૄ݁߹ʁ

Slide 38

Slide 38 text

38

Slide 39

Slide 39 text

39 Ҏ্ɻ

Slide 40

Slide 40 text

40 ͱ͍͏ͷ΋ΞϨͳͷͰ

Slide 41

Slide 41 text

41 ૄ݁߹ͷͨΊͷ
 ςΫχοΫΛʢࡶʹʣ঺հ

Slide 42

Slide 42 text

w4JOHMF3FTQPOTJCJMJUZ1SJODJQMF w0QFODMPTFEQSJODJQMF w-JTLPWTVCTUJUVUJPOQSJODJQMF w*OUFSGBDFTFHSFHBUJPOQSJODJQMF w%FQFOEFODZJOWFSTJPOQSJODJQMF 42 SOLID ݪଇ ີ݁߹→ૄ݁߹

Slide 43

Slide 43 text

w୯Ұ੹೚ͷݪଇ w։์ด࠯ͷݪଇ wϦείϑͷஔ׵ݪଇ wΠϯλϑΣʔε෼཭ͷݪଇ wґଘੑٯసͷ๏ଇ 43 SOLID ݪଇ ີ݁߹→ૄ݁߹

Slide 44

Slide 44 text

44

Slide 45

Slide 45 text

w40-*%ݪଇ͕कΒΕ͍ͯΔίʔυ͸
 ͦͷҰͭҰͭʹ͍ͭͯɺؔ৺ͷ෼཭͕
 ߦΘΕ͍ͯΔͱݴ͑Δ w͢ͳΘͪɺݸʑͷίʔυʹ͓͚Δ
 ؔ৺ࣄ͕গͳ͍ w͢ͳΘͪɺૄ݁߹ͩͱݴ͑Δ 45 SOLID ݪଇ ີ݁߹→ૄ݁߹

Slide 46

Slide 46 text

wૄ݁߹ͳγεςϜʹର͢Δςετ͸
 ͭͷςετίʔυ͕ෛ͏੹຿͕ڱ͍ wςετΛ࣮ࢪ͢Δࡍͷ४උॲཧ͕
 গͳ͘ͳΔέʔε͕ଟ͍ 46 ૄ݁߹ × ςετ ີ݁߹→ૄ݁߹

Slide 47

Slide 47 text

wۃ࿦ͱͯ͠͸ɺ֤ཁૉʹର͢Δ65͕
 ॻ͔Ε͍ͯΕ͹*5͸ͦ͜·Ͱ
 ؤுΒͳͯ͘΋ࡁΉ 47 ૄ݁߹ × ςετ ີ݁߹→ૄ݁߹

Slide 48

Slide 48 text

48 ͰʁHow to ૄ݁߹ʁ

Slide 49

Slide 49 text

w6OJUZ։ൃ͋Δ͋Δ wີ݁߹ˠૄ݁߹ w$MFBO"SDIJUFDUVSFʹ͍ͭͯ w$"'6ʹ͍ͭͯ 49 ͓͠ͳ͕͖

Slide 50

Slide 50 text

Clean Architecture ʹ͍ͭͯ 50

Slide 51

Slide 51 text

51 ͷɺલʹ

Slide 52

Slide 52 text

w͜͜·Ͱ͸୯ҰͷΫϥεʹؔ͢Δ
 ؔ৺ͷ෼཭ʹ͍ͭͯ wҰͭࢹ࠲Λ֦͛ͯϨΠϠʔʹؔ͢Δ
 ؔ৺ͷ෼཭ʹ͍ͭͯߟ͑Δ 52 ؔ৺ͷ෼཭ Clean Architecture ʹ͍ͭͯ

Slide 53

Slide 53 text

wιϑτ΢ΣΞΞʔΩςΫνϟ ʹԙ͍ͯɺҰൠʹҎԼͷ
 Α͏ʹϨΠϠʔΛ෼͚Δ
 ʢίτ͕ଟ͍ʣ w1SFTFOUBUJPO ݟͨ໨ w%PNBJO ϩδοΫ w%BUB σʔλ 53 ؔ৺ͷ෼཭ for ϨΠϠʔ Presentation Domain Data Clean Architecture ʹ͍ͭͯ

Slide 54

Slide 54 text

w.7$΍.71ͳͲͷ
 ΞʔΩςΫνϟʹΑΓ
 1SFTFOUBUJPOͱ%PNBJO
 ͷ෼཭͕࣮ݱ͞ΕΔ w֤ΞʔΩςΫνϟͰ
 ෼཭ͷ۩ମతͳखஈ͸
 ༷ʑ w.71΍.77.ͩͱ
 3YΛ࢖͏ͷ͕Ұൠతʁ 54 ؔ৺ͷ෼཭ for ϨΠϠʔ Presentation Domain Data Clean Architecture ʹ͍ͭͯ

Slide 55

Slide 55 text

w%PNBJOͱ%BUBͷ෼཭͸
 ֤छσβΠϯύλʔϯ͕
 ୲͏͜ͱ͕ଟ͔ͬͨ wͱ͍͏͔ɺ.7Ͱ͸
 %PNBJO૚Ҏ߱ʹ͍ͭͯͷ
 ੹຿ΛΞʔΩςΫνϟ
 ͱͯ͠͸ෛ͍ͬͯͳ͍ײ͡ 55 ؔ৺ͷ෼཭ for ϨΠϠʔ Presentation Domain Data Clean Architecture ʹ͍ͭͯ

Slide 56

Slide 56 text

wͰɺͦͷล΋ఆٛͨ͠
 ΞʔΩςΫνϟ͕ొ৔͢Δ w)FYBHPOBM"SDIJUFDUVSF w0OJPO"SDIJUFDUVSF w$MFBO"SDIJUFDUVSF 56 ؔ৺ͷ෼཭ for ϨΠϠʔ Presentation Domain Data Clean Architecture ʹ͍ͭͯ

Slide 57

Slide 57 text

57 Α͏΍͘ຊ୊

Slide 58

Slide 58 text

w6ODMF#PC 3PCFSU$.BSUJO ࢯ͕ ೥݄ʹఏҊ wJ04ͷ7*1&3ͳΜ͔΋ίϨ͕ݯྲྀ 58 Clean Architecture Clean Architecture ʹ͍ͭͯ

Slide 59

Slide 59 text

59 Clean Architecture Clean Architecture ʹ͍ͭͯ

Slide 60

Slide 60 text

60 ͳΔ΄ͲɺΘ͔ΒΜɻ

Slide 61

Slide 61 text

61 ࢲͳΓʹղऍͯ͠Έͨ

Slide 62

Slide 62 text

wϨΠϠʔͷ໾ׂΛఆٛ͢Δ wϨΠϠͷ੹຿Λ໌֬Խ wOBNFTQBDFͳͲͰ
 ෼͔Γ΍͘͢͢Δ 62 Clean Architecture Clean Architecture ʹ͍ͭͯ

Slide 63

Slide 63 text

wґଘͷϧʔϧΛकΔ wؔ৺ͷ޲͖͸Ұํ޲ wݪଇతʹಉϨΠϠʔؒ͸
 ґଘͤ͞ͳ͍ wϨΠϠʔΛඈͼӽ͑ͳ͍ 63 Clean Architecture Clean Architecture ʹ͍ͭͯ

Slide 64

Slide 64 text

wϨΠϠʔఆٛ͸ࣗ༝ w਺ͱ͔͸ෆఆ wϓϩμΫτຖʹॊೈʹ w଍Γͳ͖Ό૿΍͢ 64 Clean Architecture Clean Architecture ʹ͍ͭͯ

Slide 65

Slide 65 text

wϨΠϠʔؒͷؔ৺Λ෼཭ w40-*%ݪଇ wJOUFSGBDFΛ༻͍ͯ
 ۩৅Ϋϥε΁ͷґଘഉআ w%FQFOEFODZ*OKFDUJPOT 65 Clean Architecture Clean Architecture ʹ͍ͭͯ

Slide 66

Slide 66 text

wಉ৺ԁͷਤ͸ؔ৺ͷ޲͖ w಺ଆ͸֎ଆΛ஌Βͳ͍ w(BUFXBZT͸%#͕
 Ͳ͏΍ͬͯσʔλΛ
 ѻ͏͔͸஌Βͳ͍ɺͱ͔ wσʔλͷྲྀΕ͸ผͷ͓࿩ wӈԼͷਤ͕ιϨ 66 Clean Architecture Clean Architecture ʹ͍ͭͯ

Slide 67

Slide 67 text

67 ΜͰ

Slide 68

Slide 68 text

68 ͜ΕΛ Unity ʢ͔ͬͯ C#ʣ
 Ͱ࣮૷ͯ͠Έͨ

Slide 69

Slide 69 text

w6OJUZ։ൃ͋Δ͋Δ wີ݁߹ˠૄ݁߹ w$MFBO"SDIJUFDUVSFʹ͍ͭͯ w$"'6ʹ͍ͭͯ 69 ͓͠ͳ͕͖

Slide 70

Slide 70 text

CAFU ʹ͍ͭͯ 70

Slide 71

Slide 71 text

w$MFBO"SDIJUFDUVSF'PS6OJUZͷུ wʮ͔;ʔʯͱಡΉ wώωϦ͕ͳ͍ͱ͔ݴΘͳ͍ɻ w.*5-JDFOTFͳ044 wIUUQTHJUIVCDPNVNNQSPKFDUTDBGV@DPSF 71 CAFU is Կʁ CAFU ʹ͍ͭͯ

Slide 72

Slide 72 text

wجຊతʹ͸JOUFSGBDFͷΈΛఏڙ w6OJUZͱର࿩͢Δ্ͰඞཁʹͳΔ
 ΫϥεΛఏڙ wΩοζελʔͷΞϓϦ։ൃͰ
 ௒ઈ࢖ͬͯΔ 72 CAFU is Կʁ CAFU ʹ͍ͭͯ

Slide 73

Slide 73 text

73 ϨΠϠʔఆٛ

Slide 74

Slide 74 text

74 ϨΠϠʔఆٛ CAFU ʹ͍ͭͯ

Slide 75

Slide 75 text

75 ґଘؔ܎ CAFU ʹ͍ͭͯ

Slide 76

Slide 76 text

w.POP#FIBWJPVSͱର࿩͠
 ݟͨ໨Λ࢘ΔϨΠϠʔ w1SFTFOUFSͷΈґଘՄ 76 Presentation / View CAFU ʹ͍ͭͯ

Slide 77

Slide 77 text

w7JFXͱ6TF$BTFΛܨ͙ϨΠϠʔ w6TF$BTF͸ޙड़ wঢ়ଶΛ࣋ͨͳ͍ 77 Presentation / Presenter CAFU ʹ͍ͭͯ

Slide 78

Slide 78 text

wϏδωεϩδοΫͷ࣮૷ͦͷ΋ͷ wܭࢉॲཧͳͲΛ୲͏ wޙड़ͷ.PEFMͱͯ͠දݱ͞ΕΔ
 ঢ়ଶΛอ࣋ͨ͠Γ͢Δ 78 Domain / UseCase CAFU ʹ͍ͭͯ

Slide 79

Slide 79 text

wओʹ7JFXͰͷར༻Λ໨తͱͨ͠
 σʔλͷߏ଄ w6OJ3YΛ௨ͯ͡7JFXʹૹΒΕΔ w3YετϦʔϜΛؚΊͨঢ়ଶΛ؅ཧ 79 Domain / Model CAFU ʹ͍ͭͯ

Slide 80

Slide 80 text

wޙड़ͷ&OUJUZͱ.PEFMͱΛ૬ޓม׵ ͢ΔͨΊͷTranslate()ϝιουΛ
 උ͑Δ w֎෦࢓༷ͷมߋΛ6TF$BTF΍7JFX ʹ఻೻ͤ͞ͳ͍ͨΊʹఆٛ 80 Domain / Translator CAFU ʹ͍ͭͯ

Slide 81

Slide 81 text

w%BUBϨΠϠʔͱର࿩͢ΔͨΊͷ
 ϨΠϠʔ wσʔλΛಡΈॻ͖͢ΔͨΊͷ
 ΠϯλϑΣʔεΛ࣋ͭ 81 Domain / Repository CAFU ʹ͍ͭͯ

Slide 82

Slide 82 text

wσʔλͷߏ଄Λఆٛͨ͠ϨΠϠʔ wσʔλͷ࣮ମ͕ԿͰ͋Εɺ
 ߏ଄දݱͱͯ͠͸ҰͭͷΫϥεͰද͢ w4DSJQUBCMF0CKFDU͕ϝϯυΠʜɻ 82 Data / Entity CAFU ʹ͍ͭͯ

Slide 83

Slide 83 text

wσʔλͷऔΓѻ͍Λ࣮૷ͨ͠ϨΠϠʔ w4DSJQUBCMF0CKFDUͱ͔ɺ
 8FC"1*ܦ༝ͷ+40/ͱ͔ɺ
 42-JUFܦ༝ͷσʔλͱ͔ɺFUD 83 Data / DataStore CAFU ʹ͍ͭͯ

Slide 84

Slide 84 text

wFOVNͱ͔DPOTUతͳ஋Λ؅ཧ͢Δ ͨΊͷ"QQMJDBUJPOϨΠϠʔ w%*༻ͷ'BDUPSZΫϥεͱ͔Λ
 ֨ೲ͢Δ6UJMJUZϨΠϠʔ 84 ͦͷଞ CAFU ʹ͍ͭͯ

Slide 85

Slide 85 text

wམͪϞϊήʔϜΛྫʹղઆ wʙ৭ͷάϛ͕
 ݸηοτͰམԼ wͭἧ͏ͱফ͑Δ wළͷ࠷্ஈ·Ͱୡͨ͠Β
 ήʔϜΦʔόʔ wͦͷ࣌఺ͷείΞΛه࿥ 85 ྫ͑͹ CAFU ʹ͍ͭͯ

Slide 86

Slide 86 text

• Controller w γʔϯ੍ޚ w 1SFTFOUFSॳظԽ • Gummi w ߱ͬͯ͘Δάϛ
 •Floor wϘτϧͷচ •Ceil wϘτϧͷఱҪ •Wall wϘτϧͷน 86 Presentation / View CAFU ʹ͍ͭͯ

Slide 87

Slide 87 text

•StagePresenter wγʔϯैଐ1SFTFOUFS 87 Presentation / Presenter CAFU ʹ͍ͭͯ

Slide 88

Slide 88 text

•GummiStateUseCase wεςʔδதͷάϛͷঢ়ଶ Λ؅ཧɾܭࢉ wάϛண஍ˠ࠶ܭࢉͱ͔ wͪ͗Ε൑ఆͱ͔ •ScoreUseCase wಘ఺Λ؅ཧɾܭࢉ •StageUseCase wεςʔδͷߏ੒Λ؅ཧ wԿ৭ͷάϛΛग़͢ʁ wམԼεϐʔυ͸ʁ 88 Domain / UseCase CAFU ʹ͍ͭͯ

Slide 89

Slide 89 text

•GummiModel wάϛҰͭ෼Λදݱ w৭ͱ͔4UBUFͱ͔ •GummiMapModel wεςʔδ಺ͷશάϛ৘ใ
 •ForecastGummiModel w༧ࠂάϛͷঢ়ଶ •ScoreModel wݱࡏͷಘ఺ •PointModel wάϛফڈʹΑΔ֫ಘಘ఺ 89 Domain / Model CAFU ʹ͍ͭͯ

Slide 90

Slide 90 text

•GummiTranslator w4UBHF-FWFM&OUJUZͱ
 Ґஔ͔Β4DPSF.PEFM Λੜ੒ •ScoreEntityTranslator w4DPSF.PEFMΛ 4DPSF&OUJUZʹม׵ 90 Domain / Translator CAFU ʹ͍ͭͯ

Slide 91

Slide 91 text

•ScoreRepository wείΞΛಡΈॻ͖ •StageLevelRepository wεςʔδͷάϛ৭ߏ੒
 ͳͲͷϚελΛऔಘ 91 Domain / Repository CAFU ʹ͍ͭͯ

Slide 92

Slide 92 text

•ScoreEntity wεςʔδ෼ͷείΞ •ScoreMapEntity wશεςʔδ෼ͷείΞ
 •GummiPointMapEntity w࿈࠯ຖͷ֫ಘ఺਺Ϛελ •StageLevelEntity wεςʔδ೉қ౓ఆٛ •StageLevelMapEntity wશεςʔδ෼ͷ೉қ౓ 92 Data / Entity CAFU ʹ͍ͭͯ

Slide 93

Slide 93 text

•ScriptableObjectDataStore wγʔϯதͷ೚ҙͷ
 ίϯϙʔωϯτ͔Β
 ࢀর͞ΕΔ 4DSJQUBCMF0CKFDU͔Β
 &OUJUZΛऔಘ
 •LocalStorageDataStore wϩʔΧϧετϨʔδʹ
 +40/ͱ͔Ͱ&OUJUZΛ
 อଘͨ͠ΓಡΜͩΓ 93 Data / DataStore CAFU ʹ͍ͭͯ

Slide 94

Slide 94 text

94 σʔλͷྲྀΕ

Slide 95

Slide 95 text

wϘλϯ͕ΫϦοΫ͞ΕͯԿ͔ॲཧ͢Δ 95 σʔλͷྲྀΕ CAFU ʹ͍ͭͯ

Slide 96

Slide 96 text

wԿΒ͔ͷτϦΨʔͰঢ়ଶ͕มԽ 96 σʔλͷྲྀΕ CAFU ʹ͍ͭͯ

Slide 97

Slide 97 text

wλΠϚʔతͳ࣮૷ 97 σʔλͷྲྀΕ CAFU ʹ͍ͭͯ

Slide 98

Slide 98 text

wόφʔը૾Λαʔό͔Βऔಘ 98 σʔλͷྲྀΕ CAFU ʹ͍ͭͯ

Slide 99

Slide 99 text

wόφʔը૾Λ୺຤ʹΩϟογϡ 99 σʔλͷྲྀΕ CAFU ʹ͍ͭͯ

Slide 100

Slide 100 text

wϚελσʔλΛ4DSJQUBCMF0CKFDU͔Βऔಘ 100 σʔλͷྲྀΕ CAFU ʹ͍ͭͯ

Slide 101

Slide 101 text

wϚελσʔλΛ4DSJQUBCMF0CKFDU͔Βऔಘ
 ʢϥΠτ൛ʣ 101 σʔλͷྲྀΕ CAFU ʹ͍ͭͯ

Slide 102

Slide 102 text

·ͱΊ 102

Slide 103

Slide 103 text

wૄ݁߹ͳΞϓϦέʔγϣϯΛ
 ߏங͢Δͱϝϯςφϯεੑ w$MFBO"SDIJUFDUVSF͕Φεεϝ w$"'6࢖ͬͯΈͯͶʂ 103 ·ͱΊ

Slide 104

Slide 104 text

͓·͚ 104

Slide 105

Slide 105 text

105 ͪΐͬͱऄ଍

Slide 106

Slide 106 text

wʮґଘੑ஫ೖʯͱ͔೔ຊޠ༁͞ΕΔ wʮґଘʯͱ͔ݴ͏͔Β෼͔Γਏ͍ wࡶʹݴ͑͹ʮΠϯελϯεΛઃఆ͢Δ
 ʢड͚౉͢ʣʯͬͯίτ 106 Dependency Injections ͓·͚

Slide 107

Slide 107 text

107 Dependency Injections using UnityEngine; public class Player : MonoBehaviour { private void Update() { MovePosition(); } private void MovePosition() { var horizontal = Input.GetAxis("Horizontal"); var vertical = Input.GetAxis("Vertical"); transform.position = new Vector3( transform.position.x + horizontal, transform.position.y, transform.position.z + vertical ); } } ͓·͚ ྫ͑͹͜Μͳίʔυ

Slide 108

Slide 108 text

108 Dependency Injections var horizontal = Input.GetAxis("Horizontal"); var vertical = Input.GetAxis("Vertical"); transform.position = new Vector3( transform.position.x + horizontal, transform.position.y, transform.position.z + vertical ); ͓·͚ ֦େ

Slide 109

Slide 109 text

w.PWF1PTJUJPO Λςετ͍ͨ͠ wॎԣೖྗͷऔಘॲཧΛந৅Խ͢Δඞཁ ͕͋Δ w6OJUZ&OHJOF*OQVUΛந৅Խ͠Α͏ 109 Dependency Injections ͓·͚

Slide 110

Slide 110 text

110 Dependency Injections using UnityEngine; public class Player : MonoBehaviour { private IInput Input { get; set; } public void SetInput(IInput input) { Input = input; } private void Update() { MovePosition(); } private void MovePosition() { var horizontal = Input.GetHorizontalAxis(); var vertical = Input.GetVerticalAxis(); transform.position = new Vector3( transform.position.x + horizontal, transform.position.y, transform.position.z + vertical ); } } public class Installer : MonoBehaviour { [SerializeField] private Player player; private void Start() { player.SetInput(new UnityInput()); } } public interface IInput { float GetHorizontalAxis(); float GetVerticalAxis(); } public class UnityInput : IInput { public float GetHorizontalAxis() { return Input.GetAxis("Horizontal"); } public float GetVerticalAxis() { return Input.GetAxis("Vertical"); } } public class TestInput : IInput { public float GetHorizontalAxis() { return 1.0f; } public float GetVerticalAxis() { return 1.0f; } } ͓·͚ ͜͏ͳΔ

Slide 111

Slide 111 text

111 Dependency Injections public class PlayerTest { [UnityTest] public IEnumerator MovePositionTest() { var go = new GameObject(); var player = go.AddComponent(); yield return new WaitForEndOfFrame(); // 初期化待ち player.transform.position = Vector3.zero; player.SetInput(new TestInput()); // Dependency Injection yield return new WaitForEndOfFrame(); Assert.AreEqual(new Vector3(1f, 0f, 1f), player.transform.position); } } ͓·͚ ςετίʔυ͸ͪ͜Β

Slide 112

Slide 112 text

112 Dependency Injections public interface IInput { float GetHorizontalAxis(); float GetVerticalAxis(); } ͓·͚ ֦େʢJOUFSGBDFʣ

Slide 113

Slide 113 text

113 Dependency Injections public class UnityInput : IInput { public float GetHorizontalAxis() { return Input.GetAxis("Horizontal"); } public float GetVerticalAxis() { return Input.GetAxis("Vertical"); } } ͓·͚ ֦େʢ۩৅Ϋϥεʣ

Slide 114

Slide 114 text

114 Dependency Injections private IInput Input { get; set; } ... var horizontal = Input.GetHorizontalAxis(); var vertical = Input.GetVerticalAxis(); ͓·͚ ֦େʢར༻Ϋϥεʣ

Slide 115

Slide 115 text

115 Dependency Injections public void SetInput(IInput input) { Input = input; } ... public class Installer : MonoBehaviour { [SerializeField] private Player player; private void Start() { player.SetInput(new UnityInput()); } } ͓·͚ ֦େʢར༻Ϋϥεʣ

Slide 116

Slide 116 text

Dependency Injections ͓·͚ ֦େʢςετίʔυʣ 116 public class PlayerTest { [UnityTest] public IEnumerator MovePositionTest() { var go = new GameObject(); var player = go.AddComponent(); yield return new WaitForEndOfFrame(); // 初期化待ち player.transform.position = Vector3.zero; player.SetInput(new TestInput()); // Dependency Injection yield return new WaitForEndOfFrame(); Assert.AreEqual( new Vector3(1f, 0f, 1f), player.transform.position ); } }

Slide 117

Slide 117 text

w*OTUBMMFSΛ೚ҙͷ(BNF0CKFDUʹ
 Ξλονͯ͠1MBZFSΛઃఆ wςετͷ࣌͸1MBZFSͷΠϯελϯεʹ
 4FU*OQVU OFX5FTU*OQVU ͱ͔ w1MBZ.PEFςετͰGޙʹ࠲ඪ͕
 ʹͳͬͯΔ͔ʁΛ"TTFSU 117 Dependency Injections ͓·͚

Slide 118

Slide 118 text

118 Dependency Injections ʢΞϯνύλʔϯʣ using UnityEngine; public static class InputManager { private static IInput Input { get; set; } public static IInput GetInstance() { return Input ?? (Input = new UnityInput()); } public static void SetInstance(IInput input) { Input = input; } } public class Player : MonoBehaviour { private void Update() { MovePosition(); } private void MovePosition() { var horizontal = InputManager.GetInstance().GetHorizontalAxis(); var vertical = InputManager.GetInstance().GetVerticalAxis(); transform.position = new Vector3( transform.position.x + horizontal, transform.position.y, transform.position.z + vertical ); } } ͓·͚ Ұํɺ͜Μͳίʔυ

Slide 119

Slide 119 text

119 Dependency Injections ʢΞϯνύλʔϯʣ public static class InputManager { private static IInput Input { get; set; } public static IInput GetInstance() { return Input ?? (Input = new UnityInput()); } public static void SetInstance(IInput input) { Input = input; } } ͓·͚ ֦େʢ*OQVU.BOBHFSʣ

Slide 120

Slide 120 text

120 Dependency Injections ʢΞϯνύλʔϯʣ var horizontal = InputManager.GetInstance().GetHorizontalAxis(); var vertical = InputManager.GetInstance().GetVerticalAxis(); ͓·͚ ֦େʢར༻Ϋϥεʣ

Slide 121

Slide 121 text

w͜Ε͸ɺαʔϏεϩέʔλύλʔϯͱ ͍͏%*ʹ͓͚ΔΞϯνύλʔϯͰ͢ w*OQVU.BOBHFS΁ͷґଘ͕૿͑ͯ
 ͠·͍ɺґଘؔ܎ͷݟ௨͕͠ѱ͍ wςετ͢Δ࣌ʹ*OQVU.BOBHFS΁ͷ
 Πϯελϯεઃఆ͕௥ՃͰඞཁʹͳΔ 121 Dependency Injections ʢΞϯνύλʔϯʣ ͓·͚

Slide 122

Slide 122 text

122 ऄ଍͓ΘΓ

Slide 123

Slide 123 text

123 Thank you for your attention!!