¡¡ÆÃÄê¤Î¥á¥½¥Ã¥ÉÆ⤫¤é¤·¤«¼Â¹ÔÌ¿Îá¤Î¤Ê¤¤¥á¥½¥Ã¥É¤Ï¡¢Ä̾ï¤Î¥á¥½¥Ã¥É¤Ç¤Ï¤Ê¤¯¡¢¼Â¹ÔÌ¿Îá¤Î½ñ¤¤¤Æ¤¢¤ë¥á¥½¥Ã¥ÉÆâ¤Ë
¥í¡¼¥«¥ë´Ø¿ô¤È¤·¤ÆÄêµÁ¤·¤¿Êý¤¬½èÍý¤òÆɤ߲ò¤¤ä¤¹¤¯¤Ê¤ê¤Þ¤¹¡£¥³¥ë¡¼¥Á¥ó¥á¥½¥Ã¥É¤â¥í¡¼¥«¥ë´Ø¿ô¤¬ÍøÍѤǤ¤Þ¤¹¡£
¡¡¥í¡¼¥«¥ë´Ø¿ô¤Ï¼«Æ°Åª¤Ë private °·¤¤¤Ë¤Ê¤ë¤¿¤á¡¢¥¢¥¯¥»¥¹½¤¾þ»Ò¤Ïµ½Ò¤Ç¤¤Þ¤»¤ó¡£
¡ã¥í¡¼¥«¥ë´Ø¿ô¤ò³èÍѤ·¤Ê¤¤¥±¡¼¥¹¡ä
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NormalMethodSample : MonoBehaviour {
public void SetUp() {
StartCoroutine(DelayAttack());
}
¡¡¡¡private IEnumerator DelayAttack() {
yield return new WaitForSecounds(1.0f);
Debug.Log("Attack");
}
}
¡ã¥í¡¼¥«¥ë´Ø¿ô¤ò³èÍѤ¹¤ë¥±¡¼¥¹¡ä
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LocalMethodSample_Refact : MonoBehaviour {
public void SetUp() {
StartCoroutine(DelayAttack());
/// <summary>
/// SetUp ¥á¥½¥Ã¥ÉÆâ¤Ç¤Î¤ß»ÈÍѤ¹¤ë¥í¡¼¥«¥ë´Ø¿ô
/// ¸Æ¤Ó½Ð¤·¸µ¤¬£±¤Ä¤Î¥á¥½¥Ã¥É¤Ë¸ÂÄꤵ¤ì¤Æ¤¤¤ë¥á¥½¥Ã¥É¤Ï¡¢¤½¤Î¥á¥½¥Ã¥ÉÆâ¤Ë¥í¡¼¥«¥ë´Ø¿ô¤òÍÑ°Õ¤·¤¿Êý¤¬½èÍý¤¬Æɤߤ䤹¤¯¤Ê¤ê¤Þ¤¹
/// </summary>
/// <returns></returns>
IEnumerator DelayAttack() {¡¡¡¡//¡¡½¤¾þ»Ò¤Ïºï½ü
yield return new WaitForSecounds(1.0f);
Debug.Log("Attack");
}
}
}
¡¡¥á¥½¥Ã¥ÉÆâ¤Ç¤¢¤ì¤Ð¥í¡¼¥«¥ë´Ø¿ô¤ÎÀë¸À¤Ï¤É¤³¤Ç¤â²Äǽ¤Ç¤¹¡£
Î㤨¤Ð²¼µ¤Î¤è¤¦¤Ëµ½Ò¤·¤Æ¤¢¤Ã¤Æ¤âÌäÂꤢ¤ê¤Þ¤»¤ó¡£
¡ã¥í¡¼¥«¥ë´Ø¿ô¤ÎÀë¸À¡¡ä
public void SetUp() {
/// <summary>
/// SetUp ¥á¥½¥Ã¥ÉÆâ¤Ç¤Î¤ß»ÈÍѤ¹¤ë¥í¡¼¥«¥ë´Ø¿ô
/// ¸Æ¤Ó½Ð¤·¸µ¤¬£±¤Ä¤Î¥á¥½¥Ã¥É¤Ë¸ÂÄꤵ¤ì¤Æ¤¤¤ë¥á¥½¥Ã¥É¤Ï¡¢¤½¤Î¥á¥½¥Ã¥ÉÆâ¤Ë¥í¡¼¥«¥ë´Ø¿ô¤òÍÑ°Õ¤·¤¿Êý¤¬½èÍý¤¬Æɤߤ䤹¤¯¤Ê¤ê¤Þ¤¹
/// </summary>
/// <returns></returns>
IEnumerator DelayAttack() {¡¡¡¡//¡¡½¤¾þ»Ò¤Ïºï½ü
yield return new WaitForSecounds(1.0f);
Debug.Log("Attack");
}
StartCoroutine(DelayAttack());
}
¡ã¥í¡¼¥«¥ë´Ø¿ô¤ÎÀë¸À¢¡ä
public void SetUp() {
StartCoroutine(DelayAttack());
/// <summary>
/// SetUp ¥á¥½¥Ã¥ÉÆâ¤Ç¤Î¤ß»ÈÍѤ¹¤ë¥í¡¼¥«¥ë´Ø¿ô
/// ¸Æ¤Ó½Ð¤·¸µ¤¬£±¤Ä¤Î¥á¥½¥Ã¥É¤Ë¸ÂÄꤵ¤ì¤Æ¤¤¤ë¥á¥½¥Ã¥É¤Ï¡¢¤½¤Î¥á¥½¥Ã¥ÉÆâ¤Ë¥í¡¼¥«¥ë´Ø¿ô¤òÍÑ°Õ¤·¤¿Êý¤¬½èÍý¤¬Æɤߤ䤹¤¯¤Ê¤ê¤Þ¤¹
/// </summary>
/// <returns></returns>
IEnumerator DelayAttack() {¡¡¡¡//¡¡½¤¾þ»Ò¤Ïºï½ü
yield return new WaitForSecounds(1.0f);
Debug.Log("Attack");
}
// ½èÍý¤ÎÁ°¸å¤Ë¥í¡¼¥«¥ë´Ø¿ô¤¬Àë¸À¤·¤Æ¤¢¤Ã¤Æ¤âÌäÂꤢ¤ê¤Þ¤»¤ó¡£
¡¡¡¡¡¡¡¡Debug.Log("End Attack");
}
¡¡¥á¥½¥Ã¥ÉÆâ¤ËÄêµÁ¤Ç¤¤ë¥í¡¼¥«¥ë´Ø¿ô¤Î¿ô¤Ë¤âÀ©¸Â¤Ï¤Ê¤¤¤¿¤á¡¢Ê£¿ô¤Î¥í¡¼¥«¥ë´Ø¿ô¤ò£±¤Ä¤Î¥á¥½¥Ã¥ÉÆâ¤ËÄêµÁ¤¹¤ë¤³¤È¤â½ÐÍè¤Þ¤¹¡£
¡¡¥×¥í¥°¥é¥à¤Ï¡¢·è¤á¤é¤ì¤¿µ¬Â§¤ÎÃæ¤Ç¤¢¤ì¤Ð¡¢¥¨¥ó¥¸¥Ë¥¢¤¬¼«Ê¬¤Ç¹Í¤¨¤¿Æȼ«¤Î½èÍý¤òµ½Ò¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
¥¤¥á¡¼¥¸¤·¤¿½èÍý¤ò¤Þ¤º¤Ï½ñ¤¤¤Æ¤ß¤Æ¡¢Æ°ºî¤¹¤ë¤«¤ò³Îǧ¤·¤Æ¤ß¤ë¤È¤è¤¤¤Ç¤·¤ç¤¦¡£
¾¡¼ê¤Ë½ÐÍè¤Ê¤¤¤â¤Î¤È»×¤¤¹þ¤Þ¤º¤Ë¡¢¤É¤¦¤¹¤ì¤Ð¤¤¤¤¤Î¤«¡¢¤È¤¤¤¦´ÑÅÀ¤«¤é¹Í¤¨¤Æ¤¤¤¯¤è¤¦¤Ë¤¹¤ë¤³¤È¤¬ÂçÀڤǤ¹¡£
¡¡¥í¥¸¥Ã¥¯¤ò¹Í¤¨¤Æ¤¤¤¯¤³¤È¤ÏÂçÊѤǤϤ¢¤ê¤Þ¤¹¤¬¡¢¤³¤ì¤Ï¥×¥í¥°¥é¥à¤ò½ñ¤¤¤Æ½èÍý¤òÆ°¤«¤¹Âé¸ïÌ£¤Ç¤¢¤ê¡¢Â¾¤Ç¤ÏÆÀÆñ¤¤Âθ³¤Ë¤â·Ò¤¬¤ê¤Þ¤¹¡£
¡¡
¡¡°Ê¾å¤Ë¤Ê¤ê¤Þ¤¹¡£