示例#1
0
    // Update is called once per frame
    void Update()
    {
        Vector3 viewPos = cam.WorldToViewportPoint(grayTransform.position);

        if (viewPos.x < 0 || viewPos.y < 0 || viewPos.y > 1)
        {
            musicGO.Pause();
            moveGrayScript.StopMoving();
            moveCamScript.StopMoving();
            loseScreen.SetActive(true);
            loseText.text = "Colors : " + colorScript.getColors() + "\nScore : " + scoreScript.getScore();
        }
    }
示例#2
0
    public void Oribt(Transform thing)
    {
        IsOrbiting = true;
        Vector3 dir = transform.position - thing.position;

        dir.Normalize();
        float angle = 0;

        angle += Vector3.Angle(Vector3.right, dir.normalized);
        orbit  = thing;
        if (dir.y < 0)
        {
            angle *= -1;
        }
        transform.rotation = Quaternion.Euler(0, 0, angle);
        transform.parent   = thing;

        transform.localPosition = transform.localPosition.normalized * 2.85f;
        mover.StopMoving();
        OnNewOrbit?.Invoke(thing);
    }
    void OnTriggerEnter(Collider col)
    {
//		if (col.gameObject.name == "3x1block" || col.gameObject.name == "1x1block") {
//			Debug.Log ("collision " + col.gameObject.name);
//			moveScript.enabled = false;
//		}
        Debug.Log("collision " + col.gameObject.name);
        if (col.gameObject.tag == "Drop")
        {
            dropGO.Play();
            scoreScript.incrementScore();
            Destroy(col.gameObject);
        }

        if (col.gameObject.tag == "Wall")
        {
            breakGO.Play();
            colorScript.incrementColors();
            musicScript.SwitchColors(colorScript.getColors());


            //moveCamScript.IncrementSpeed();
            //moveGrayScript.IncrementSpeed();

            Destroy(col.gameObject);

            // END OF THE GAME
            if (col.gameObject.name == "Violet Wall")
            {
                musicGO.Pause();
                moveGrayScript.StopMoving();
                moveCamScript.StopMoving();
                winScreen.SetActive(true);
                winText.text = "Colors : 7\nScore : " + scoreScript.getScore();
            }
        }
    }