private void OnTriggerEnter2D(Collider2D collision) { if (gameObject.name != "Boss") { PlayerUnit pu = collision.gameObject.GetComponent <PlayerUnit>(); if (pu) { pu.GetComponent <Collider2D>().enabled = false; Debug.Log("Bye" + gameObject.name); pu.Die(vD, vS); } else { PlayerShrink ps = collision.gameObject.GetComponent <PlayerShrink>(); if (ps) { if (lazer) { firstHitTime = Time.time; } else { ps.Die(vD, vS); } } } } }
private void OnTriggerStay2D(Collider2D collision) { PlayerShrink ps = collision.gameObject.GetComponent <PlayerShrink>(); if (ps) { if (lazer && Time.time > (firstHitTime + (1.0f / (float)dmgPerSecond))) { ps.Die(vD, vS); firstHitTime = Time.time; } } }