Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            InvokeRepeating("Fire", 0.000001f, firingRate);
        }

        if (Input.GetKeyUp(KeyCode.Space))
        {
            CancelInvoke("Fire");
        }

        if (Input.GetKey(KeyCode.RightArrow))
        {
            transform.position += Vector3.right * speed * Time.deltaTime;
        }
        else if (Input.GetKey(KeyCode.LeftArrow))
        {
            transform.position += Vector3.left * speed * Time.deltaTime;
        }

        // Restrict the play to the game space
        float newX = Mathf.Clamp(transform.position.x, xmin, xmax);

        transform.position = new Vector3(newX, transform.position.y, transform.position.z);

        ExtraShips exShip = gameObject.GetComponent <ExtraShips> ();

        // Player's Lives
        //UpdatePlayersLives (exShip);

        PlayerLivesBar.displayPlayersLives();
    }
Ejemplo n.º 2
0
 void UpdatePlayersLives(ExtraShips eShip)
 {
     // Player's Lives
     if (eShip.getMaxLive() <= lives)
     {
         PlayerLivesBar.displayPlayersLives("Lives: Max - ");
     }
     else
     {
         PlayerLivesBar.displayPlayersLives();
     }
 }