private void OnTriggerStay2D(Collider2D collision) { tempbullet = collision.GetComponent <colorBullet>(); templayzer = collision.GetComponent <Layzercolor>(); if (tempbullet != null) { if (tempbullet.bulletcol == m_color) { tempcharge = collision.GetComponent <Charger>(); hp -= tempbullet.bulletdamage; if (tempcharge != null) { tempcharge.spread(); } Destroy(collision.gameObject); } } else if (templayzer != null) { if (templayzer.bulletcol == m_color && !invi) { invi = true; StartCoroutine("invitime"); hp -= templayzer.bulletdamage;; } } }
private void OnTriggerEnter2D(Collider2D collision) { Debug.Log("fasssadasdasasdasdsfa"); tempbullet = collision.GetComponent <colorBullet>(); Debug.Log("fdsfa"); if (tempbullet.bulletcol == ufocolor) { Debug.Log("fdssadasfa"); hp -= tempbullet.bulletdamage; Destroy(collision.gameObject); if (hp <= 0) { Destroy(this.gameObject); } } }
// Start is called before the first frame update void Start() { me = gameObject.GetComponent <colorBullet>(); Destroy(this.gameObject, 10); }