Пример #1
0
    // 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;
    }
Пример #2
0
 // 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");
         }
     }
 }
Пример #3
0
 public void ButtonPlayPressed()
 {
     LifePointer.addLifePoint(5);    //Updating life
     Score.RefreshScore();           //and scores
     SceneManager.LoadScene("1");
 }