private void OnTriggerStay2D(Collider2D collision) { if (collision.tag == "Player" && ((parentScript.tag.Contains("Player") == false))) { PublicValueStorage.Instance.GetPlayerComponent().ActivatePlayerDie(); } if (parentScript.laserType == LaserVer2.LaserType.CircleLaser) { if (collision.tag == "PlayerShield") { parentScript.activeCircleLaser = false; PublicValueStorage.Instance.AddMissileScore(); float value = Time.deltaTime * 1.2f; parentScript.transform.localScale -= new Vector3(value, value, 0); if (parentScript.transform.localScale.x <= 1.0f) { Vector3 reflectPosition = collision.transform.position; reflectPosition.y += spriteRenderer.bounds.extents.y * 5.0f; parentScript.CreateLaserForPlayer(reflectPosition); Destroy(parentScript.gameObject); } } } }
private void OnTriggerEnter2D(Collider2D collision) { if (this.tag != "PlayerReflectLaser") { if (collision.tag == "PlayerShield") { if (parentScript.createLaserFrontReady == true && parentScript.createLaserEndReady == false) { parentScript.createLaserEndReady = true; Vector3 reflectPosition = collision.transform.position; reflectPosition.y += spriteRenderer.bounds.extents.y * 5.0f; parentScript.CreateLaserForPlayer(reflectPosition); } if (parentScript.createLaserFrontReady != false) { Destroy(parentScript.gameObject); } } if (collision.tag == "Player") { Destroy(parentScript.gameObject); } if (collision.tag == "WasteBasket") { Destroy(parentScript.gameObject); } } else { if (collision.tag == "WasteBasket") { Destroy(parentScript.gameObject); } //Debug.Log(this.GetType().ToString() + " detected " + collision.tag); } }