ãœããã¯ã»ã¶ã»ãããžããã°ã®ã²ãŒã ã¯ãéã®æ茪ãšã¹ããŒãããŒããªããããã·ã¥ã«ãŒã ã®ãªãã¹ãŒããŒããªãªãç¹ã®ç¹æ» ãªãã®ããã¯ãã³ã®ããã«èŠããŸããïŒ ããããã¹ãŠã®ã²ãŒã ã¯ãã£ãšéå±ã§ãïŒ
ããŒãã¹ïŒãã¯ãŒã¢ããïŒã¯ãã²ãŒã ãã¬ã€ã®æãéèŠãªã³ã³ããŒãã³ãã§ããããã¯ãæ°ããã¬ãã«ã®è€éããšæŠç¥ãè¿œå ãããã¬ã€ã€ãŒã«è¡åãä¿ãããã§ãã
ãã®ãã¥ãŒããªã¢ã«ã§ã¯ã次ã®ããšãåŠã³ãŸãã
- ä»ã®ã²ãŒã ã§ç¹°ãè¿ã䜿çšã§ããå¯èœæ§ã®ããããŒãã¹ã·ã¹ãã ãèšèšããã³æ§ç¯ããŸãã
- ã²ãŒã ã§ã¡ãã»ãŒãžããŒã¹ã®éä¿¡ã·ã¹ãã ã䜿çšããŸãã
- ç¬èªã®ããŒãã¹ã䜿çšããŠãããããã¥ãŒã®ã²ãŒã ã§ããããã¹ãŠå®çŸããŠãã ããïŒ
泚ïŒãã®ãã¥ãŒããªã¢ã«ã§ã¯ãUnityã«ç²ŸéããŠãããå°ãªããšãCïŒã®äžéç¥èãããããšãåæãšããŠããŸãã ç¥èã磚ãå¿ èŠãããå Žåã¯ãä»ã®Unityãã¥ãŒããªã¢ã«ãã芧ãã ãã ã
ãã¥ãŒããªã¢ã«ã®æé ãç¹°ãè¿ãã«ã¯ãUnity 2017.1以éã®ããŒãžã§ã³ãå¿ èŠã«ãªãããããŸã Unityã®ããŒãžã§ã³ãã¢ããã°ã¬ãŒãããŠããªãå Žåã¯ã¢ããã°ã¬ãŒãããŠãã ããã
4MB GIF
ä»äºãå§ãã
ç§ãã¡ãåãçµãã§ããã²ãŒã ã¯ããã¬ã€ã€ãŒãæµããããããšããå¹³é¢å³ãæã€2次å ã®ã¢ãŒã±ãŒãã²ãŒã ã§ãã Geometry Warsã«å°ã䌌ãŠããŸãããçºå°ããïŒãããŠåæ¥çã«æåããŸããïŒã ãã«ã¡ããããã¶ã£ãããŒããŒã¯ãåºå£ã«ãã©ãçãããã«æµããããå¿ èŠããããŸãã æµã«çŽé¢ãããšã圌ã®å¥åº·ã¯äœäžããŸãã å¥åº·ãçµãããšãã²ãŒã ãªãŒããŒãå§ãŸããŸãã
ãã®ãã¥ãŒããªã¢ã«ã®ãã©ãããããŠã³ããŒãããç®çã®ãã©ã«ããŒã«æœåºããŸãã Unityã§ãããžã§ã¯ããéãããããžã§ã¯ããã©ã«ããŒã調ã¹ãŸãã
- é³å£° ïŒã²ãŒã ã®å¹æé³ãã¡ã€ã«ãå«ãŸããŠããŸãã
- ææ ïŒã²ãŒã ææã
- ãã¬ãã ïŒã²ãŒã ã®ãã¬ãããå«ãŸããŠããŸããããã«ã¯ã競æå Žããã¬ãŒã€ãŒãæµãããŒãã£ã¯ã«ãããŒãã¹ãå«ãŸããŸãã
- ã·ãŒã³ ïŒã²ãŒã ã®ã¡ã€ã³ã·ãŒã³ã§ãã
- ã¹ã¯ãªãã ïŒè©³çŽ°ãªã³ã¡ã³ãä»ãã®CïŒã²ãŒã ã¹ã¯ãªãããå«ãŸããŠããŸãã äœæ¥ãéå§ããåã«ã¹ã¯ãªããã«æ £ãããå Žåã¯ããããã®ã¹ã¯ãªããã調æ»ã§ããŸãã
- ãã¯ã¹ã㣠ïŒã²ãŒã ããã³ã¹ã¯ãªãŒã³ã»ãŒããŒã«äœ¿çšããããœãŒã¹ã€ã¡ãŒãžã
mainãšããã·ãŒã³ãéãã[ åç ]ãã¿ã³ãã¯ãªãã¯ããŸãã
ã²ãŒã ã«ã¯ãŸã ããŒãã¹ããããŸããã ãããã£ãŠãã¬ãã«ãæž¡ãã®ã¯é£ãããã²ãŒã ã¯å°ãéå±ã«æããŸãã ç§ãã¡ã®ã¿ã¹ã¯ã¯ãããŒãã¹ãè¿œå ããã²ãŒã ã掻æ§åããããšã§ãã ãã¬ãŒã€ãŒãããŒãã¹ãç²åŸãããšãæ¢ç¥ã®äžé£ã®æ ç»ããã®åŒçšãç»é¢ã«è¡šç€ºãããŸãã 圌女ãèªèã§ãããã©ããèŠãŠã¿ãŸãããã çãã¯ãã¥ãŒããªã¢ã«ã®æåŸã«ãããŸãïŒ
ããŒãã¹ã©ã€ããµã€ã¯ã«
ããŒãã¹ã«ã¯ãããã€ãã®åå¥ã®ç¶æ ã§æ§æãããã©ã€ããµã€ã¯ã«ããããŸãã
- æåã®æ®µéã¯äœæã§ã ãããã¯ã²ãŒã ããã»ã¹ãŸãã¯éçºæ®µéã§å®è¡ãããã·ãŒã³ã«GameObjectããŒãã¹ãæåã§é 眮ããŸãã
- 次ã«ã 泚æãåŒãã¢ãŒãããããŸãããã㯠ãããŒãã¹ãã¢ãã¡ãŒã·ã§ã³åããããããã¬ã€ã€ãŒã®æ³šæãåŒãããšãã§ããå Žåã§ãã
- åé段éã¯ããŒãã¹ãååŸããã¢ã¯ã·ã§ã³ã§ãããããã«ãããµãŠã³ããããŒãã£ã¯ã«ã·ã¹ãã ããŸãã¯ãã®ä»ã®ç¹æ®å¹æãããªã¬ãŒãããŸãã
- ããŒãã¹ã®éžæã¯ãããŒãã¹ããä»äºãããã ãã€ããŒãã®å±¥è¡ã«ã€ãªãããŸãã ãã€ããŒãã¯ãããããªå¥åº·å¢é²ããããã¬ã€ã€ãŒã«é©ãã¹ãè¶ å€§åœãžã®å¯ä»ãŸã§äœã§ãããŸããŸããã ãã€ããŒããã§ãŒãºã¯åŠ¥åœæ§ãã§ãã¯ãåŒãèµ·ãããŸãã ããŒãã¹ã¯ãç¹å®ã®æéã®åŸããã¬ãŒã€ãŒãæµã«è§ŠããåŸãæ°å䜿çšããåŸããŸãã¯ã²ãŒã ããã»ã¹ã®ä»ã®æ¡ä»¶ãæºããããåŸã«è¡åãåæ¢ããããã«æ§æã§ããŸãã
- æ€èšŒã¯å®äºæ®µéã«ã€ãªãããŸãã å®äºã¹ããŒãžã¯ããŒãã¹ãç Žå£ãããµã€ã¯ã«ã®çµããã«ãªããŸãã
äžèšã®ã©ã€ããµã€ã¯ã«ã«ã¯ãä»»æã®ã²ãŒã ã§äœ¿çšãã䟡å€ã®ããèŠçŽ ãšãç¹å®ã®ã²ãŒã ã«ã®ã¿é©çšãããèŠçŽ ãå«ãŸããŠããŸãã ããšãã°ããã¬ãŒã€ãŒã®ããŒãã¹ã®éžæã確èªããããšã¯åã²ãŒã ã§äœ¿çšããå¿ èŠããããŸããããã¬ãŒã€ãŒãèŠããªãããç¹å®ã®ãã€ããŒãã¯ãã®ã²ãŒã ã§ã®ã¿äœ¿çšãã䟡å€ããããŸãã ã¹ã¯ãªããããžãã¯ãã¶ã€ã³ãäœæãããšãã¯ããããèæ ®ããããšãéèŠã§ãã
ã·ã³ãã«ãªããŒãã¹ã¹ã¿ãŒãäœæãã
æãå¯èœæ§ãé«ãã®ã¯ããŽãŒã«ãã³ã€ã³ãæããŸãã¯ãªã³ã°ã§ããããšã³ããªãŒã¬ãã«ãã®ããŒãã¹ã«ç²ŸéããŠããããã€ã³ããç²åŸãããããã«ã¹ãå¢å ããããããããšã§ãã ããã§ãã·ãŒã³ã«ããŒãã¹ã¹ã¿ãŒãäœæããŸããããã«ããããã¬ã€ã€ãŒã®äœåãå³åº§ã«å¢å ããããŒããŒãã¬ãã«ãçãæãå¯èœæ§ãé«ãŸããŸãã
ã¬ãã«ããè±åºããã«ã¯ãæã ãã«é Œãã ãã§ã¯ååã§ã¯ãªãã®ã§ãåŸã§ããŒããŒã«æŠéã§æå©ã«ãªãä»ã®ããŒãã¹ãè¿œå ããŸãã
æ°ããã¹ãã©ã€ããäœæãã PowerUpStarãšããååãä»ããŠãããŒããŒã®çäžïŒXïŒ6ãYïŒ-1.3ïŒã«é 眮ããŸãã ã·ãŒã³ãåçåããã«ã¯ãã·ãŒã³ã®ã¹ãã©ã€ãã空ã®GameObject PowerUpsã®åã«ããŸãã
次ã«ãã¹ãââã©ã€ãã®å€èŠ³ãèšå®ããŸãã å€æã¹ã±ãŒã« ïŒXïŒ0.7ãYïŒ0.7ïŒã®å€ãå ¥åãã ã¹ãã©ã€ãã¬ã³ãã©ãŒã³ã³ããŒãã³ãã§ã ã¹ãã©ã€ãã¹ãããã«æãå²ãåœãŠãè²ã«æ·¡è€è²ïŒRïŒ211ãGïŒ221ãBïŒ200ïŒãéžæããŸãã
Box Collider 2Dã³ã³ããŒãã³ããè¿œå ãã Is Triggerããã¯ã¹ããªã³ã«ããŠã SizeãïŒXïŒ0.2ãYïŒ0.2ïŒã«å€æŽããŸãã
æåã®ããŒãã¹ãäœæããŸããïŒ ã²ãŒã ãå®è¡ããŠããã¹ãŠãæ£åžžã«èŠããããšã確èªããŸãã ããŒãã¹ã衚瀺ãããŸããããããäžããããšããŠãäœãèµ·ãããŸããã ãããä¿®æ£ããã«ã¯ãã¹ã¯ãªãããå¿ èŠã§ãã
ã²ãŒã ããžãã¯ãã¯ã©ã¹éå±€ããåé¢ãã
責任ããéçºè ãšããŠãç§ãã¡ã¯æéããããã䜿ãã以åã®ãããžã§ã¯ãã®èŠçŽ ãåå©çšããããšèããŠããŸãã ãããããŒãã¹ã·ã¹ãã ã«é©çšããã«ã¯ã ã¯ã©ã¹éå±€ã䜿çšããŠãã¶ã€ã³ãäœæããå¿ èŠããããŸã ã ã¯ã©ã¹éå±€ã¯ãããŒãã¹ã®ããžãã¯ããšã³ãžã³ã®åå©çšå¯èœãªéšåãšç¹å®ã®ã²ãŒã ã®ã¿ã«é¢é£ããéšåã«åå²ããŸãã ã¯ã©ã¹éå±€ãšç¶æ¿ã®æŠå¿µãããããªãå Žåã¯ãããããã¹ãŠã®æŠå¿µã説æãããããªããããŸã ã
äžèšã®å³ã¯ã
PowerUp
ã¯ã©ã¹ã芪ã¯ã©ã¹ãšããŠç€ºããŠããŸãã ã²ãŒã ã«äŸåããªãããžãã¯ãå«ãŸããŠãããããä»ã®ã»ãšãã©ã®ãããžã§ã¯ãã§ããã®ãŸãŸãåå©çšã§ããŸãã ãã¥ãŒããªã¢ã«ãããžã§ã¯ãã«ã¯æ¢ã«èŠªã¯ã©ã¹ããããŸãã 芪ã¯ã©ã¹ã¯ãããŒãã¹ã®ã©ã€ããµã€ã¯ã«ãããŒãã¹ã®ããŸããŸãªæ¡ä»¶ãè¡çªã®åŠçãããŒãã¹ã®ååŸããã€ããŒããã¡ãã»ãŒãžãããŒãã¹ã®æå¹æéãå¶åŸ¡ããŸãã
芪ã¯ã©ã¹ã¯ãããŒãã¹ã®ã©ã€ããµã€ã¯ã«ã远跡ããåçŽãªã¹ããŒããã·ã³ãå®è£ ããŸãã æ°ããããŒãã¹ããšã«ãµãã¯ã©ã¹ãšã€ã³ã¹ãã¯ã¿ãŒã®å€ãå®è£ ããå¿ èŠããããŸããããã ãã§ãïŒ
ããŒãã¹ã³ãŒãã£ã³ã°ãã§ãã¯ãªã¹ã
泚ïŒããŒãã¹ã¹ã¯ãªãããäœæããã«ã¯ã PowerUpã¯ã©ã¹ããµãã¯ã©ã¹åãããªã¹ãå ã®ãã¹ãŠã®ã¢ã€ãã ãå®è¡ãããããã«ããå¿ èŠããããŸãã ãã¥ãŒããªã¢ã«ã§ã¯ããã®ãªã¹ããæ°ååç §ããã®ã§ãæå ã«çœ®ããŠãããŠãã ããïŒ
-
PowerUpPayload
ãå®è£ ããŠããã€ããŒããèµ·åããŸãã - ãªãã·ã§ã³ïŒ
PowerUpHasExpired
ãå®è£ ããŠãåã®æé ãããã€ããŒããåé€ããŸãã - ããŒãã¹ã®æå¹æéãåã
PowerUpHasExpired
ãPowerUpHasExpired
åŒã³åºããŸãã ããã«æéãåããå Žåã¯ãã€ã³ã¹ãã¯ã¿ãŒã§ExpiresImmediatelyãã§ãã¯ããã¯ã¹ãéžæããŸãããã®å ŽåãPowerUpHasExpired
ãåŒã³åºãå¿ èŠããªãããPowerUpHasExpired
ã
ããŒãã¹ã¹ã¿ãŒãäœãããã®ãèããŠã¿ãŸããããããã¯å¥åº·ããããã«å¢å ãããã ãã§ãã ãããè¡ãã«ã¯ãå°ããªã¹ã¯ãªããã§ååã§ãã
ããŒãã¹ã®æåã®ã¹ã¯ãªãããäœæãã
GameObject PowerUpStarã«æ°ããã¹ã¯ãªãããè¿œå ãã PowerUpStarãšããååãä»ããŠãšãã£ã¿ãŒã§éããŸãã
GIF
次ã®ã³ãŒããè¿œå ããUnityã®åæãã€ã©ãŒãã¬ãŒãã³ãŒãã®å€§éšåã眮ãæããŠãå é ã«
using
æ§æã®ã¿
using
æ®ããŸãã
class PowerUpStar : PowerUp { public int healthBonus = 20; protected override void PowerUpPayload() // 1 { base.PowerUpPayload(); // playerBrain.SetHealthAdjustment(healthBonus); } }
ã³ãŒãã¯éåžžã«çãã§ãããã¹ã¿ãŒã®ããžãã¯ãå®è£ ããã«ã¯ååã§ãïŒ ãã®ã¹ã¯ãªããã¯ããã§ãã¯ãªã¹ãã®ãã¹ãŠã®é ç®ã«å¯Ÿå¿ããŠããŸãã
-
PowerUpPayload
ã¯ãã¬ã€ã€ãŒã«ããããã®å¥åº·ãäžããŸã
playerBrain.SetHealthAdjustment
ãåŒã³åºããŸããPowerUp
芪ã¯ã©ã¹PowerUp
ãPowerUp
ãžã®ãªã³ã¯ã®ååŸããã§ã«è¡ã£PowerUp
ããŸãã 芪ã¯ã©ã¹ããããšããäºå®ã¯ãbase.PowerUpPayload
ãåŒã³åºããŠããã¹ãŠã®åºæ¬çãªããžãã¯ãã³ãŒãã®åã«å®è¡ãããããã«ããå¿ èŠãããããšãæå³ããŸãã - ãã«ã¹ã®è¿œå ã¯ãã£ã³ã»ã«ãããªãããã
PowerUpHasExpired
ãå®è£ ããå¿ èŠã¯ãããŸããã - ãã®ããŒãã¹ã¯ããã«æéåãã«ãªããããäœãæžãå¿ èŠã¯ãããŸããã ã€ã³ã¹ãã¯ã¿ã®[ExpiresImmediately]ãã§ãã¯ããã¯ã¹ããªã³ã«ããã ãã§ãã ã¡ãœãããä¿åããŠUnityã«æ»ããã€ã³ã¹ãã¯ã¿ãŒã«å€æŽãå ãããšããæ¥ãŸããã
ã·ãŒã³ã§æåã®ããŒãã¹ãäœæãã
ä¿åããŠUnity GameObjectã«æ»ããšã StarPowerUpã¯ã€ã³ã¹ãã¯ã¿ãŒã§æ¬¡ã®ããã«ãªããŸãã
ã€ã³ã¹ãã¯ã¿ãŒã®å€ã次ã®ããã«å ¥åããŸãã
- ãã¯ãŒã¢ããããŒã ïŒã¹ã¿ãŒ
- 説æ ïŒãã«ã¹ãå埩ããŸãã...
- Power Up Quote ïŒïŒæ³å以äžã«åŒ·åã«ãªããŸãïŒ
- ããã«æéåã ïŒãã§ãã¯
- ç¹æ®å¹æ ïŒ Prefabs / Power Ups / ParticlesCollectedãããžã§ã¯ããã©ã«ããããã¬ããããã©ãã°ã¢ã³ããããã
- å¹æé³ ïŒãããžã§ã¯ããã©ã«ãAudio / power_up_collect_01ãããªãŒãã£ãªã¯ãªããããã©ãã°ããŸã
- å¥åº·ããŒãã¹ ïŒ40
ãããè¡ããšãããŒãã¹ã¯æ¬¡ã®ããã«ãªããŸãã
PowerUpStarãªãã·ã§ã³ã䜿ãçµãã£ããããããPrefabs / Power Upsãããžã§ã¯ãããªãŒãã©ã«ããŒã«ãã©ãã°ããŠããã¬ãããäœæããŸãã
GIF
æ°ãããã¬ããã䜿çšããŠãã·ãŒã³ã®å³åŽã«ããã€ãã®æãè¿œå ããŸãã
ã·ãŒã³ãèµ·åããããŒããŒãæåã®ããŒãã¹ã«å°ããŸãã ããŒãã¹ã®éžæã«ã¯ãçŽ æŽãããå¹æé³ãšããŒãã£ã¯ã«ã䌎ããŸãã ãããïŒ
ã¡ãã»ãŒãžããŒã¹ã®ã³ãã¥ãã±ãŒã·ã§ã³
次ã«äœæããããŒãã¹ã«ã¯ãèæ¯æ å ±ãå¿ èŠã§ãã ãã®æ å ±ãååŸããã«ã¯ãäºãã«ããŒã¿ã亀æããæ¹æ³ãåŠç¿ããGameObjectsãå¿ èŠã§ãã
ããšãã°ãããŒãã¹ãéžæãããšãUIã¯ã©ã®æ å ±ã衚瀺ããå¿ èŠãããããç¥ãå¿ èŠããããŸãã ãã¬ãŒã€ãŒã®å¥åº·ç¶æ ãå€åãããšããšãã«ã®ãŒã®é£ç¶ã¯ãæŽæ°ãããã¬ãã«ã®å¥åº·ç¶æ ãäœã§ããããç¥ãã¯ãã§ãã ããã¯ããŸããŸãªæ¹æ³ã§å®è£ ã§ããŸãããUnityããã¥ã¢ã«ã«ã¯ããã€ãã®ã¡ã«ããºã ããªã¹ããããŠããŸã ã
éä¿¡ã®åæ¹æ³ã«ã¯é·æãšçæãããããã¹ãŠã®ã±ãŒã¹ã«é©ãããã®ãéžæããããšã¯ã§ããŸããã ã²ãŒã ã§ã¯ãUnityã¬ã€ãã§èª¬æãããŠããããã«ã ã¡ãã»ãŒãžããŒã¹ã®éä¿¡ãå®è£ ããŸã ã
ã¡ãã»ãŒãž éä¿¡è ãã¡ãã»ãŒãžéä¿¡è ããŸãã¯ãã®äž¡æ¹ã§GameObjectãäœæã§ããŸã ã
äžã®å³ã®å·ŠåŽã¯ãã¡ãã»ãŒãžéä¿¡æ©ã瀺ããŠããŸã ã ããªãã¯ãããããªããžã§ã¯ããšã¿ãªãããšãã§ããäœãé¢çœãããšãèµ·ãããšãå«ã³ããŸãã ããšãã°ããã¬ãŒã€ãŒããç§ã¯æªæãããŠããŸãããšããã¡ãã»ãŒãžãéä¿¡ããå Žåã å³ã®å³åŽã¯ã ã¡ãã»ãŒãžãªã¹ãã瀺ããŠããŸã ã ååã瀺ãããã«ã圌ãã¯ã¡ãã»ãŒãžãèããŸãã ãªã¹ããŒã¯ã ãã¹ãŠã®ã¡ãã»ãŒãžãèãå¿ èŠã¯ãããŸããã è¿ä¿¡ãããã¡ãã»ãŒãžã ããèããŸãã
ã¡ãã»ãŒãžéä¿¡æ©ã¯ãªã¹ããŒã«ãªãããšãã§ããŸãã ããšãã°ãããŒãã¹ã¯ã¡ãã»ãŒãžãéä¿¡ããŸããããã¬ã€ã€ãŒã®ã¡ãã»ãŒãžãèããŸãã ããã§ã®è¯ãäŸã¯ããŒãã¹ã§ããããã¯ããã¬ã€ã€ãŒãæµã«åœãã£ããšãã«æéãåããŸãã
å€ãã®éä¿¡æ©ãšå€ãã®ãªã¹ããŒãããå Žåãå·ŠåŽãšå³åŽã®éã«å€ãã®äº€å·®ããã©ã€ã³ãããã¯ãã§ããããšãç解ã§ããŸãã ç§ãã¡ã®ç掻ãç°¡çŽ åããããã«ãUnityã«ã¯äžå€®ã«EventSystemã³ã³ããŒãã³ãããããŸãïŒ
Unityã¯ãæ¡åŒµå¯èœãªEventSystemã³ã³ããŒãã³ãã䜿çšããŠå ¥åãåŠçããŸãã ãã®ã³ã³ããŒãã³ãã¯ãéä¿¡ããã³åä¿¡ã€ãã³ãããžãã¯ã®ã»ãšãã©ãå¶åŸ¡ããŸãã
ã¯ããå€ãã®çè«ããããŸãããèŠçŽãããšãã¡ãã»ãŒãžã·ã¹ãã ã䜿çšãããšãããŒãã¹ã§ã²ãŒã ãã¬ã€ãç°¡åã«èãããšãã§ãããªããžã§ã¯ãéã®ããŒãæ¥ç¶ã®æ°ãæžããããšãã§ããŸãã ããã«ãããç¹ã«éçºã®åŸæ段éã§ã¯ãã»ãšãã©ã®ã¡ãã»ãŒãžããã§ã«éä¿¡ããããããæ°ããããŒãã¹ãç°¡åã«è¿œå ã§ããŸãã
ã¡ãã»ãŒãžããŒã¹ã®é¢ä¿ãäœæããæé
å§ããåã«ãå°ãçè«ãå¿ èŠã§ãã ã¡ãã»ãŒãžããããŒããã£ã¹ãããã«ã¯ã次ã®æé ãå®è¡ããå¿ èŠããããŸãã
- ãã©ã³ã¹ããã¿ãŒã¯ãäŒãããã¡ãã»ãŒãžãCïŒã€ã³ã¿ãŒãã§ãŒã¹ãšããŠå®çŸ©ããŸãã
- 次ã«ããã©ã³ã¹ããã¿ã¯ããªã¹ãã®ãªã¹ãã«ä¿åãããŠãããªã¹ãã«ã¡ãã»ãŒãžãéä¿¡ããŸãã
ç¥èãæŽæ°ããå¿ èŠãããå Žåã¯ãCïŒã€ã³ã¿ãŒãã§ãŒã¹ã«é¢ãããã®ãããªãåç §ããŠãã ããã
ã€ãŸããã€ã³ã¿ãŒãã§ã€ã¹ã¯ã¡ãœããã·ã°ããã£ãå®çŸ©ããŸãã ã€ã³ã¿ãŒãã§ã€ã¹ãå®è£ ããã¯ã©ã¹ã¯ããããã®ã¡ãœããã«æ©èœãæäŸããããšãçŽæããŸãã
ããã¯äŸã§ããæ確ã«èŠãããšãã§ããŸãã IPlayerEvents.csãã¡ã€ã«ã®ã³ãŒããèŠãŠãã ããïŒ
public interface IPlayerEvents : IEventSystemHandler { void OnPlayerHurt(int newHealth); void OnPlayerReachedExit(GameObject exit); }
ãã®CïŒã€ã³ã¿ãŒãã§ã€ã¹ã«ã¯ã
OnPlayerHurt
ããã³
OnPlayerReachedExit
ã¡ãœããããã
OnPlayerReachedExit
ã ãããã¯ããã¬ãŒã€ãŒãéä¿¡ã§ããã¡ãã»ãŒãžã§ãã 次ã«ã
SendPlayerHurtMessages
ãã¡ã€ã«ã®
SendPlayerHurtMessages
ã¡ãœãããèŠãŠãã ããã 次ã®ã³ãŒããã©ã°ã¡ã³ãã§çªå·ãä»ããããŠããè¡ã«ã€ããŠã以äžã§èª¬æããŸãã
private void SendPlayerHurtMessages() { // foreach (GameObject go in EventSystemListeners.main.listeners) // 1 { ExecuteEvents.Execute<IPlayerEvents> // 2 (go, null, // 3 (x, y) => x.OnPlayerHurt(playerHitPoints) // 4 ); } }
äžèšã®ã¡ãœããã¯ã
OnPlayerHurt
ã¡ãã»ãŒãžã®éä¿¡ãåŠçããŸãã
foreach
ã¯ã
EventSystemListeners.main.listeners
ãªã¹ãã«ä¿åãããŠãããã¹ãŠã®ãªã¹ããŒããã€ãã¹ããã¡ãã»ãŒãžãéä¿¡ããåãªã¹ããŒã«å¯ŸããŠ
ExecuteEvents.Execute
ãåŒã³åºããŸãã
ã³ã¡ã³ããçªå·ä»ãã§èŠãŠã¿ãŸãããã
-
EventSystemListeners.main.listeners
ã¯ãã·ã³ã°ã«ãã³ã®EventSystemListeners
ãªããžã§ã¯ãã§ã°ããŒãã«ã«è¡šç€ºãããEventSystemListeners.main.listeners
ã®ãªã¹ãã§ãã ãã¹ãŠã®ã¡ãã»ãŒãžããªãã¹ã³ããGameObjectã¯ããã®ãªã¹ãã«å«ãŸããŠããå¿ èŠããããŸãã ã€ã³ã¹ãã¯ã¿ãŒã§Listener
ã«EventSystemListeners.main.AddListener
ã©ãã«ãå²ãåœãŠãããEventSystemListeners.main.AddListener
ãåŒã³åºãããšã«ããããã®ãªã¹ãã«EventSystemListeners.main.AddListener
ãŸãã -
ExecuteEvents.Execute
ã¯ãUnityãExecuteEvents.Execute
ã¡ãã»ãŒãžãéä¿¡ããã¡ãœããã§ãã å±±ã«ãã³å ã®ã¿ã€ãã¯ãéä¿¡ããã¡ãã»ãŒãžãå«ãã€ã³ã¿ãŒãã§ã€ã¹ã®ååã§ãã - ããã¯ã Unityããã¥ã¢ã«ã®æ§æäŸã«åŸã£ãŠãã¡ãã»ãŒãžã®éä¿¡å
ã®GameObjectãšè¿œå ã€ãã³ãæ
å ±ã®
null
ãå®çŸ©ããŸã ã - ã©ã ãåŒ ã ããã¯è€éãªCïŒã®æŠå¿µã§ããããã®ãã¥ãŒããªã¢ã«ã§ã¯åãäžããŸããã ã€ãŸããã©ã ãåŒã䜿çšãããšãã¡ãœããã«ãã©ã¡ãŒã¿ãŒãšããŠã³ãŒããæž¡ãããšãã§ããŸãã ãã®å Žåãã³ãŒãã«ã¯ãéä¿¡ããã¡ãã»ãŒãžïŒ
OnPlayerHurt
ïŒãšå¿ èŠãªãã©ã¡ãŒã¿ãŒïŒplayerHitPoints
ïŒãå«ãŸããŠããŸãã
ãããžã§ã¯ãã¯ãå¿ èŠãªãã¹ãŠã®ã¡ãã»ãŒãžãéä¿¡ããããã«ãã§ã«æ§æãããŠããŸãã ãããã®ããã€ãã¯ããããžã§ã¯ããæ¡åŒµããç¬èªã®ããŒãã¹ãè¿œå ããå Žåã«äŸ¿å©ã§ãã æšæºã®é 眮ã§ã¯ããã¹ãŠã®ã€ã³ã¿ãŒãã§ã€ã¹åã¯æåIã§å§ãŸããŸãã
-
IPlayerEvents
ïŒãã¬ãŒã€ãŒãããããããšãããŸãã¯çµäºãããšãã«ã¡ãã»ãŒãžã«äœ¿çšãããŸãã -
IPowerUpEvents
ïŒããŒãã¹ãIPowerUpEvents
ãããšãããŸãã¯ãã®ã¢ã¯ã·ã§ã³ãçµäºãããšãã®ã¡ãã»ãŒãžã«äœ¿çšãããŸãã -
IMainGameEvents
ïŒãã¬ã€ã€ãŒãIMainGameEvents
ãšãã®ã¡ãã»ãŒãžã«äœ¿çšãããŸãã
ãããã®ã€ã³ã¿ãŒãã§ãŒã¹ã¯ãã¹ãŠè©³çŽ°ã«ã³ã¡ã³ããããŠãããããåŠç¿ããããšãã§ããŸãã ãã®ãã¥ãŒããªã¢ã«ã§ãããã«å¯ŸåŠããå¿ èŠã¯ãããŸãããå¿ èŠã«å¿ããŠå ã«é²ãããšãã§ããŸãã
ã¹ããŒãã¢ããããŒãã¹
ã¡ãã»ãŒãžããŒã¹ã®éä¿¡ã«ã€ããŠç¥ã£ãã®ã§ãããã䜿çšããŠã¡ãã»ãŒãžãèããŸãïŒ
ãã¬ã€ã€ãŒãäœãã«ééãããŸã§è¿œå ã®é床ãäžããããŒãã¹ãäœæããŸãã ããŒãã¹ã¯ãã²ãŒã ãã¬ã€ãèããªãããã¬ã€ã€ãŒã®è¡çªãèªèããŸãã ããå ·äœçã«ã¯ããç§ã¯æªæãããŠããŸãããšããã¡ãã»ãŒãžãéä¿¡ãããã¬ã€ã€ãŒãããŒãã¹ãåãåããŸãã
ã¡ãã»ãŒãžãèãã«ã¯ã次ã®æé ã«åŸãå¿ èŠããããŸãã
- é©åãªCïŒã€ã³ã¿ãŒãã§ã€ã¹ãå®è£ ããŠããªã¹ãã³ã°ããGameObjectããªãã¹ã³ããå¿ èŠããããã®ã瀺ããŸãã
- ãªã¹ãã³ã°ãã
EventSystemListeners.main.listeners
èªäœãEventSystemListeners.main.listeners
ãªã¹ãã«è¡šç€ºããŸãã
æ°ããã¹ãã©ã€ããäœæãã
PowerUpSpeed
ãšããååãä»ããŠããã¬ãŒã€ãŒã®äžã®ã¢ãªãŒãã®å·Šäžé ã®ã©ããã«é 眮ããŸãã ãã®ã¹ã±ãŒã«ã ïŒXïŒ0.6ãYïŒ0.6ïŒã«èšå®ããŸãã ãã®GameObjectã¯ãªã¹ããŒã«ãªããããã€ã³ã¹ãã¯ã¿ãŒã§ãªã¹ããŒã瀺ããŸãã
Box Collider 2Dãè¿œå ãããã®ãµã€ãºãïŒXïŒ0.2ãYïŒ0.2ïŒã«å€æŽããŸãã Sprite Rendererã³ã³ããŒãã³ãã§ã Spriteã®fastã®å€ãèšå®ããã¹ã¿ãŒã§è¡ã£ãããã«ãã®è²ãå€æŽããŸãã Is Triggerããã¯ã¹ããã§ãã¯ããããšãå¿ããªãã§ãã ããã ãã®åŸãGameObjectã¯æ¬¡ã®ããã«ãªããŸãã
ãã®GameObjectã«æ°ããPowerUpSpeedã¹ã¯ãªãããè¿œå ãã次ã®ã³ãŒããã¹ã¯ãªããã«è²Œãä»ããŸãã
class PowerUpSpeed : PowerUp { [Range(1.0f, 4.0f)] public float speedMultiplier = 2.0f; protected override void PowerUpPayload() // 1 { base.PowerUpPayload(); playerBrain.SetSpeedBoostOn(speedMultiplier); } protected override void PowerUpHasExpired() // 2 { playerBrain.SetSpeedBoostOff(); base.PowerUpHasExpired(); } }
ãã§ãã¯ãªã¹ãã®é ç®ã確èªããŠãã ããã ã¹ã¯ãªããã¯ã次ã®ããã«åã¢ã€ãã ãå®è¡ããŸãã
-
PowerUpPayload
ãbase
ã¡ãœãããåŒã³åºããŠèŠªã¯ã©ã¹ãžã®åŒã³åºããæäŸãããã¬ãŒã€ãŒã«å éãäžããŸãã 芪ã¯ã©ã¹ã¯playerBrain
å®çŸ©ããŸããããã«ã¯ãããŒãã¹ãåéãããã¬ãŒã€ãŒãžã®ãªã³ã¯ãå«ãŸããŸãã -
PowerUpHasExpired.
ãã¬ãŒã€ãŒã«äžããããå éãåé€ããŠãããbase
ã¡ãœãããåŒã³åºãå¿ èŠããããŸãã - ãã§ãã¯ãªã¹ãã®æåŸã®é
ç®ã¯ãããŒãã¹ã®æå¹æéãåããåŸã«
PowerUpHasExpired
ãåŒã³åºããŠããŸãã åŸã§ããã¬ã€ã€ãŒã®ã¡ãã»ãŒãžãèããŠãããå®è£ ããŸãã
ã¯ã©ã¹å®£èšãå€æŽããŠããã¬ãŒã€ãŒã¡ãã»ãŒãžã®ã€ã³ã¿ãŒãã§ã€ã¹ãå®è£ ããŸãã
class PowerUpSpeed : PowerUp, IPlayerEvents
æ³šïŒ Visual Studioã§äœæ¥ããŠããå Žåãå ¥ååŸã«IPlayerEvents
èŠçŽ ã«IPlayerEvents
ãã¡ãã¥ãŒãªãã·ã§ã³[ ã€ã³ã¿ãŒãã§ã€ã¹ãæ瀺çã«å®è£ ]ãéžæã§ããŸãã ããã«ãããã¡ãœããã¹ã¿ããäœæãããŸãã
次ã®ããã«ãªããŸã§ã¡ãœãããè¿œå ãŸãã¯å€æŽããããããPowerUpSpeedã¯ã©ã¹ã®äžéšã§ããããšã確èªããŸãã
void IPlayerEvents.OnPlayerHurt(int newHealth) { // if (powerUpState != PowerUpState.IsCollected) { return; } // , PowerUpHasExpired(); // 3 } /// <summary> /// IPlayerEvents, /// </summary> void IPlayerEvents.OnPlayerReachedExit(GameObject exit) { }
IPlayerEvents.OnPlayerHurt
ã¡ãœãã
IPlayerEvents.OnPlayerHurt
ããã¬ãŒã€ãŒããã¡ãŒãžãåãããã³ã«åŒã³åºãããŸãã ããã¯ããããŒããã£ã¹ãã¡ãã»ãŒãžãèãããšã®äžéšã§ãã ãã®æ¹æ³ã§ã¯ãéžæåŸã«åããŠããŒãã¹ãåå¿ãããŸãã 次ã«ãã³ãŒãã¯èŠªã¯ã©ã¹ã§
PowerUpHasExpired
ãåŒã³åºããæå¹æéããžãã¯ãåŠçããŸãã
ãã®ã¡ãœãããä¿åããŠUnityã«æ»ããã€ã³ã¹ãã¯ã¿ãŒã§å¿ èŠãªå€æŽãå ããŸãã
ã·ãŒã³ã¹ããŒãããŒã¹ãããŒãã¹ã®äœæ
GameObject SpeedPowerUpã¯ãã€ã³ã¹ãã¯ã¿ãŒã§æ¬¡ã®ããã«ãªããŸãã
ã€ã³ã¹ãã¯ã¿ãŒã«æ¬¡ã®å€ãå ¥åããŸãã
- ãã¯ãŒã¢ããå ïŒã¹ããŒã
- 説æ ïŒæµãšæ¥è§ŠãããŸã§ã®è¶ é«é移å
- ãã¯ãŒã¢ããèŠç©ã ïŒïŒ12ããŒã»ãã¯æªæºã§ã±ãã»ã«ãå®è¡ããŸãïŒ
- ããã«æéåã ïŒãã§ãã¯ãå€ããŸã
- ç¹æ®å¹æ ïŒããŒãã£ã¯ã«ã®åéïŒã¹ã¿ãŒãšåãïŒ
- å¹æé³ power_up_collect_01ïŒã¹ã¿ãŒãšåãïŒ
- ã¹ããŒããã«ããã©ã€ã€ãŒ ïŒ2
ãã®åŸãããŒãã¹ã¯æ¬¡ã®ããã«ãªããŸãã
å¿ èŠã«å¿ããŠSpeedããŒãã¹ãªãã·ã§ã³ãæ§æãããããããPrefabs / Power Upsãããžã§ã¯ãããªãŒãã©ã«ããŒã«ãã©ãã°ããŠããã¬ãããäœæããŸãã ãã¢ãããžã§ã¯ãã§ã¯äœ¿çšããŸããããå®å šãæãããã«å®è¡ãã䟡å€ããããŸãã
ã·ãŒã³ãèµ·åããããŒããŒã移åãããŠé床ããŒãã¹ãåéããŸãããã®åŸã圌ã¯è¿œå ã®é床ãåãåããæµãšæ¥è§ŠãããŸã§æ®ããŸãã
åçºããŒãã¹
次ã®ããŒãã¹ã§ã¯ããã¬ãŒã€ãŒã¯PããŒãæŒããŠãªããžã§ã¯ããéªéã«ãªããªãããã«ããã·ã¥ã§ããŸãã ãã®ã¢ããªã±ãŒã·ã§ã³ã®æ°ã¯éãããŠããŸãã ããŒãã¹ãäœæãã段éã«ã€ããŠã¯ãã§ã«ãåãã§ãããããã£ãŠãããã¹ããä¹±éã«ããªãããã«ãã³ãŒãã®æãèå³æ·±ãéšåã®ã¿ãæ€èšããŠããããã¬ãããäœæããŸãã ãã®ããŒãã¹ã¯ãã¡ãã»ãŒãžãèãå¿ èŠã¯ãããŸããã
ãããžã§ã¯ãéå±€ã§PowerUpPush ãã¬ãããèŠã€ããŠæ¢çŽ¢ããŸãã PowerUpPushãšããã¹ã¯ãªãããéããã³ãŒãã調ã¹ãŸãã
ãã§ã«èª¿æ»ããããªãã¿ã®ã¡ãœããã衚瀺ãããŸãã èå³æ·±ãåçºããŒãã¹ã¢ã¯ã·ã§ã³ã¯ãã¹ãŠã Updateã¡ãœããã§çºçããŸã ã
private void Update () { if (powerUpState == PowerUpState.IsCollected && //1 numberOfUsesRemaining > 0) //2 { if (Input.GetKeyDown ("p")) //3 { PushSpecialEffects (); //4 PushPhysics (); //5 numberOfUsesRemaining--; if (numberOfUsesRemaining <= 0) { PowerUpHasExpired (); //7 } } } }
ãã®ã³ãŒãã§ã¯æ¬¡ã®ããšãè¡ãããŸãã
- åéãããããŒãã¹ã«å¯ŸããŠã®ã¿ã¹ã¯ãªãããå®è¡ããå¿ èŠããããŸãã
- ã¹ã¯ãªããã¯ã䜿çšåæ°ãæ®ã£ãŠããå Žåã«ã®ã¿å®è¡ããå¿ èŠããããŸãã
- ã¹ã¯ãªããã¯ããã¬ãŒã€ãŒãPãã¯ãªãã¯ãããšãã«ã®ã¿å®è¡ãããå¿ èŠããããŸãã
- ã¹ã¯ãªããã¯ããã¬ãŒã€ãŒã®åšãã«çŸããããŒãã£ã¯ã«å¹æãèµ·åããŸãã
- ã¹ã¯ãªããã¯ããã¬ã€ã€ãŒããæµãæéããŸãã
- ããŒãã¹ãåã³äœ¿çšãããŸãã
- 䜿çšåæ°ãæéåãã«ãªããšãããŒãã¹ãæéåãã«ãªããŸãã
åçºããŒãã¹ã®äœ¿çšã¯éåžžã«èå³æ·±ãã®ã§ãã¹ããŒãžäžã®é©åãªå Žæã«ã«ããã«ã眮ã䟡å€ããããŸãã ã·ãŒã³ãããäžåºŠå®è¡ããæ°ããããŒãã¹ã§ãã¬ã€ããŸãã
è¿œå ã¯ãšã¹ãïŒäžæ»èº«ããŒãã¹
ãã®ã»ã¯ã·ã§ã³ã¯ãªãã·ã§ã³ã§ãããéåžžã«èå³æ·±ããã®ã§ãã ç²åŸããç¥èã§æŠè£ ãããã¬ã€ã€ãŒããã°ããäžæ»èº«ã«ããããŒãã¹ãäœæããŸãã
ãã®ã¿ã¹ã¯ãå®äºããããã®ãã³ããšã³ãïŒ
- ã¹ãã©ã€ã ïŒãããžã§ã¯ããã©ã«ãTextures / shieldã§ã¹ãã©ã€ããèŠã€ããŸã
- ãã¯ãŒã¢ããå ïŒäžæ»èº«
- ãã¯ãŒã¢ãã説æ ïŒããªãã¯ãã°ããã®éç¡æµã§ã
- ãã¯ãŒã¢ããåŒçš ïŒïŒçŽ æŽãããåäŸãçææ°ã«ãªããªãã§ãã ããïŒ
- ã³ãŒãã£ã³ã° ïŒã¹ã¿ãŒããŒãã¹ãšã¹ããŒãããŒã¹ãã«äœ¿çšãããã®ãšåããã§ãã¯ãªã¹ãã確èªããŸãã ããŒãã¹ã®æéãå¶åŸ¡ããã¿ã€ããŒãå¿ èŠã«ãªããŸãã PlayerBrainã®SetInvulnerabilityã¡ãœããã¯ã è匱æ§ãæå¹ãŸãã¯ç¡å¹ã«ããŸãã
- ãšãã§ã¯ã ïŒãããžã§ã¯ãã«ã¯ããã¬ãŒã€ãŒãäžæ»èº«ã®ãŸãŸã§ãããšãã«ããã¬ãŒã€ãŒã®åšãã®çŸããæ³¢çŽãšãã§ã¯ãã®ããã®ããŒãã£ã¯ã«ãšãã§ã¯ããå«ãŸããŠããŸãã Prefabã¯Prefabs / Power Ups / ParticlesInvulnã«ãããŸãã æ»æãããªãéããã¬ã€ã€ãŒã®åã€ã³ã¹ã¿ã³ã¹ã«ããããšãã§ããŸãã
å®å šãªãœãªã¥ãŒã·ã§ã³ãå¿ èŠã§ããããããšãåœç€Ÿã®ãœãªã¥ãŒã·ã§ã³ãšæ¯èŒããŸããïŒ ããããããã«ãããŸãïŒ
å
éšã®ãœãªã¥ãŒã·ã§ã³
æ°ããã¹ãã©ã€ããäœæãã PowerUpInvulnãšããååãä»ããŠïŒXïŒ-0.76ãYïŒ1.29ïŒã«å
¥ããŸãã ã¹ã±ãŒã«ã§ã¯ãå€ãXïŒ0.7ãYïŒ0.7 ã«èšå®ããŸãã ãã®GameObjectã¯èª°ããªãã¹ã³ããŸãããæå®ãããæéãçµéãããšãã®æå¹æéãåããã®ã§ãã€ã³ã¹ãã¯ã¿ãŒã§ã©ãã«ãä»ããå¿
èŠã¯ãããŸããã
Box Collider 2Dãè¿œå ãã SizeãX = 0.2ãY = 0.2ã«å€æŽããŸãã ã¹ãã©ã€ãã¬ã³ãã©ãŒã³ã³ããŒãã³ãã§ãä»ã®ããŒãã¹ãšåæ§ã«ã ã¹ãã©ã€ããã·ãŒã«ãã«èšå®ããè²ãéžæããŸãã [ ããªã¬ãŒ]ããã¯ã¹ããªã³ã«ãªã£ãŠããããšã確èªããŸãã ãã®åŸãGameObjectã¯æ¬¡ã®ããã«ãªããŸãã
ãã®GameObjectã«æ°ããPowerUpInvulnã¹ã¯ãªãããè¿œå ãã次ã®ã³ãŒããããã«è²Œãä»ããŸãã
ã³ãŒããã§ãã¯ãªã¹ãã®é ç®ãããäžåºŠç¢ºèªããŠãã ããã ã¹ã¯ãªããã¯ãããã®ãã€ã³ãã次ã®ããã«å®è¡ããŸãã
ã¹ã¯ãªãããä¿åããUnityã«æ»ã£ãŠã²ãŒã ãå®è¡ããŸãã ããã§ãããŒãã¹ãæéåãã«ãªããŸã§ãå¥åº·ãšå®å šã«æ³šæãæããã«æµãæ»æããããšãã§ããŸãïŒ
Box Collider 2Dãè¿œå ãã SizeãX = 0.2ãY = 0.2ã«å€æŽããŸãã ã¹ãã©ã€ãã¬ã³ãã©ãŒã³ã³ããŒãã³ãã§ãä»ã®ããŒãã¹ãšåæ§ã«ã ã¹ãã©ã€ããã·ãŒã«ãã«èšå®ããè²ãéžæããŸãã [ ããªã¬ãŒ]ããã¯ã¹ããªã³ã«ãªã£ãŠããããšã確èªããŸãã ãã®åŸãGameObjectã¯æ¬¡ã®ããã«ãªããŸãã
ãã®GameObjectã«æ°ããPowerUpInvulnã¹ã¯ãªãããè¿œå ãã次ã®ã³ãŒããããã«è²Œãä»ããŸãã
class PowerUpInvuln : PowerUp { public float invulnDurationSeconds = 5f; public GameObject invulnParticles; private GameObject invulnParticlesInstance; protected override void PowerUpPayload () // 1 { base.PowerUpPayload (); playerBrain.SetInvulnerability (true); if (invulnParticles != null) { invulnParticlesInstance = Instantiate (invulnParticles, playerBrain.gameObject.transform.position, playerBrain.gameObject.transform.rotation, transform); } } protected override void PowerUpHasExpired () // 2 { if (powerUpState == PowerUpState.IsExpiring) { return; } playerBrain.SetInvulnerability (false); if (invulnParticlesInstance != null) { Destroy (invulnParticlesInstance); } base.PowerUpHasExpired (); } private void Update () // 3 { if (powerUpState == PowerUpState.IsCollected) { invulnDurationSeconds -= Time.deltaTime; if (invulnDurationSeconds < 0) { PowerUpHasExpired (); } } } }
ã³ãŒããã§ãã¯ãªã¹ãã®é ç®ãããäžåºŠç¢ºèªããŠãã ããã ã¹ã¯ãªããã¯ãããã®ãã€ã³ãã次ã®ããã«å®è¡ããŸãã
-
PowerUpPayload
ïŒbase
ã¡ãœãããåŒã³åºããŠèŠªã¯ã©ã¹ãåŒã³åºãããã¬ãŒã€ãŒã«äžæ»èº«ã®ããŒãã¹ãäžããŸãã èåããç²åå¹æãè¿œå ããŸãã -
PowerUpHasExpired
ïŒåãåã£ãäžæ»èº«ããŒãã¹ãåé€ããŠãããbase
ã¡ãœãããåŒã³åºãå¿ èŠããããŸãã - ãã§ãã¯ãªã¹ãã®æåŸã®é
ç®ã¯ãããŒãã¹ã®æå¹æéãåãããšãã«
PowerUpHasExpired
åŒã³åºããŠããŸãã ãã®å ŽåãUpdate()
ã䜿çšããŠçµéæéãã«ãŠã³ãããŸãã
ã¹ã¯ãªãããä¿åããUnityã«æ»ã£ãŠã²ãŒã ãå®è¡ããŸãã ããã§ãããŒãã¹ãæéåãã«ãªããŸã§ãå¥åº·ãšå®å šã«æ³šæãæããã«æµãæ»æããããšãã§ããŸãïŒ
解決çãæ€èšããåã«ãåé¡ã解決ããŠã¿ãŠãã ããã
次ã¯ã©ãã«è¡ããŸããïŒ
ãã®ãã¥ãŒããªã¢ã«ã®å®æãããããžã§ã¯ãã¯ã ããããããŠã³ããŒãã§ããŸã ã
ãããžã§ã¯ããããã«éçºããå Žåã¯ã次ã®ããšãã§ããŸãã
- ããã«ããŒãã¹ãè¿œå ããŸãã ããŒãã¹å°æå ç·ã¯æµã殺ããŸããïŒ
- ã²ãŒã äžã«ã¢ãªãŒãã§ã©ã³ãã ã«ããŒãã¹ãäœæããããã®ãã¡ã¯ããªã¯ã©ã¹ãäœæããŸãã
- Unityã«ã€ããŠããã«è©³ããç¥ãããå Žåã¯ãã¹ãã¢ãããã¥ãŒããªã¢ã«ã²ãŒã ã®Unityã²ãŒã ãã芧ãã ããã
ããªãã¯ãŸã ãããã®ãã¬ãŒãºã®ã©ã®ã·ãªãŒãºããç解ããŠããªãã®ã§ããïŒ ãã¿ãã¬ã«çããïŒ
çã
ãã£ãïŒ ããªãã¯ããããããã§ã¯ãªãã¯ããã€ã³ã¿ãŒãããäžã®å¯äžã®äººã§ãïŒ åçïŒãããã¯ã¹ã¿ãŒãŠã©ãŒãºã·ãªãŒãºããã®åŒçšã§ãã