// Update is called once per frame void Update() { Vector3 velocity = new Vector3(0, BaseMoveSpeed * Time.deltaTime, 0); float withOrtho = Camera.main.orthographicSize * screenRatio; pos += transform.rotation * velocity; if (pos.x + ShipRadius > withOrtho) { pos.x = withOrtho - ShipRadius; Rotates(); } if (pos.x - ShipRadius < -withOrtho) { pos.x = -withOrtho + ShipRadius; Rotates(); } if (pos.y < -Camera.main.orthographicSize) { LifePointer.SubLifePoint(); //Taking away a life point } transform.position = pos; }
// Use this for initialization void OnTriggerEnter2D(Collider2D otherObject) { { if (otherObject.gameObject.layer == 9 || otherObject.gameObject.layer == 11 || otherObject.gameObject.layer == 12) { LifePointer.SubLifePoint(); } else if (otherObject.gameObject.layer == 14) { PlayerShooting bonus = GetComponent <PlayerShooting>(); bonus.SetBonus(); SoundManager.PlaySound("bonus"); } } }