コード例 #1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Enemy") || other.CompareTag("Obstacle"))
     {
         NPC npc = other.GetComponentInChildren <NPC>();
         npcTimer.addNpc(npc);
     }
 }
コード例 #2
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        NPC npc = other.gameObject.GetComponentInChildren <NPC>();

        if (npc != null)
        {
            npcTimer.addNpc(npc);
        }
    }