コード例 #1
0
    void OnTriggerEnter2D(Collider2D obg)
    {
        enemy_ai enemy = obg.GetComponent <enemy_ai>();

        if (enemy != null)
        {
            Destroy(obg.gameObject);
        }
    }
コード例 #2
0
 // Start is called before the first frame update
 void Start()
 {
     health           = maxhealth;
     enemyaudiosource = gameObject.GetComponent <AudioSource>();
     enemyanimations  = gameObject.GetComponent <Animator>();
     enemyattack      = gameObject.GetComponent <enemy_ai>();
     playerimpulse    = player.GetComponent <Movement>();
     enemydamge       = player.GetComponent <fighting>();
     playerstat       = player.GetComponent <Stats>();
     playeranimation  = player.GetComponent <Animator>();
     flip             = gameObject.GetComponent <enemy_flip>();
 }