Esempio n. 1
0
    void Update()
    {
        if (ws.GetKills() % 30 == 0 && ws.GetKills() != 0)
        {
            Destroy(obj);
        }

        if (DELAY <= 0)
        {
            if (GO_RIGHT)
            {
                trans.Translate(new Vector3(ws.GetLevel() * 0.05f, 0, 0));
            }
            else
            {
                trans.Translate(new Vector3(-ws.GetLevel() * 0.05f, 0, 0));
            }

            if ((trans.position.x >= boundaryRight) || (trans.position.x <= boundaryLeft))
            {
                GO_RIGHT = !GO_RIGHT;
                trans.Translate(new Vector3(0, -0.5f, 0));
            }
        }
        else
        {
            DELAY -= Time.deltaTime;
        }

        if (trans.localPosition.y < -8.5f)
        {
            Destroy(obj);
        }
    }
Esempio n. 2
0
 // Update is called once per frame
 void Update()
 {
     obj.GetComponent <TextMesh>().text   = "SCORE: " + ws.GetScore();
     level.GetComponent <TextMesh>().text = "LEVEL " + ws.GetLevel();
     if (ws.GetKills() != 0 && ws.GetKills() % 30 == 0)
     {
         ws.ResetKills();
         Invoke("AddPrompt", 1f);
     }
 }
    // Update is called once per frame
    void Update()
    {
        float offsetX = Input.GetAxis("Submit");

        if (offsetX > 0 && !Cooldown)
        {
            ws.AddLevel();
            Cooldown = true;
            Debug.Log("Current level: " + ws.GetLevel());
            Invoke("SpawnEnemy", 0.2f);
            Destroy(obj, 0.2f);
        }
    }
Esempio n. 4
0
    // Update is called once per frame
    void Update()
    {
        if (ws.GetLevel() >= 3)
        {
            time = Time.timeSinceLevelLoad;
            if (time > nextFire)
            {
                nextFire = nextFire + Random.Range(time, time + 20);

                Instantiate(bullet,
                            trans.position + new Vector3(0, -1f, 0),
                            Quaternion.identity);
            }
        }

        if (trans.position.y < -0.5f)
        {
            Debug.Log(trans.position.y);
            if (!ws.IsGameOver())
            {
                ws.GameOver();
                Instantiate(prompt,
                            new Vector3(0, 6.1f, 24.81724f),
                            Quaternion.identity);

                GameObject ship = GameObject.FindGameObjectWithTag("Ship");

                Destroy(GameObject.FindGameObjectWithTag("Ship"));

                var temp = Instantiate(explode,
                                       ship.transform.position,
                                       Quaternion.identity);

                Destroy(temp, 0.6f);
            }
        }
    }