private void OnTriggerStay(Collider other) { if (TrapType2State != TrapType2State.normal) { return; } if (other.gameObject.tag == "Player") { TrapType2State = TrapType2State.readyForAttack; StartCoroutine("StartTrapType2Thorn"); } }
IEnumerator StartTrapType2Thorn() { yield return(null); // 애니메이션 작동 yield return(new WaitForSeconds(0.2f)); rendererColor.material.color = Color.yellow; yield return(new WaitForSeconds(0.5f)); rendererColor.material.color = Color.red; yield return(new WaitForSeconds(0.5f)); attack(); rendererColor.material.color = Color.white; yield return(new WaitForSeconds(2f)); TrapType2State = TrapType2State.normal; StopCoroutine("StartTrapType2Thorn"); }
void attack() { TrapType2State = TrapType2State.attack; Instantiate(fireBall, fireBallPos.position, fireBallPos.rotation); }
// Start is called before the first frame update void Start() { TrapType2State = TrapType2State.normal; }