Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        hilangkan_api_bola();
        random_material_bola();
        nextShoot   = true;
        scriptWaktu = GameObject.Find("txtWaktu").GetComponent <sc_waktu>();

        //teksTouch = GameObject.Find("txtTouch").GetComponent<Text>();
    }
Exemplo n.º 2
0
    /*
     * void OnMouseDown() {
     *      statTekan=true;
     * }
     * void OnMouseUp() {
     *      if(statTekan==true) {
     *              statTekan=false;
     *              StartCoroutine("proses_bola");
     *      }
     * }
     */

    IEnumerator proses_bola()
    {
        if (statTekan == false)
        {
            if (this.gameObject.GetComponent <Rigidbody>() == null)
            {
                yield return(new WaitForSeconds(0.5f));

                waktuAnim = false;

                Rigidbody gameObjectRigidBody = this.gameObject.AddComponent <Rigidbody>();
                gameObjectRigidBody.mass = 5;
                //Debug.Log(this.gameObject);
                //gameObjectRigidBody.mass=5;

                if (kemiringan > toloreansiMiring || kemiringan < -toloreansiMiring)
                {
                    kemiringan -= toloreansiMiring;
                    kemiringan *= 50;
                }
                //Debug.Log("kemiringan : " + kemiringan);
                this.GetComponent <Rigidbody>().AddForce(new Vector3(-powerX, powerY, kemiringan));
                bolaDilempar = true;
                waktuAnim    = false;

                yield return(new WaitForSeconds(0.5f));

                scriptWaktu = GameObject.Find("txtWaktu").GetComponent <sc_waktu>();
                if (scriptWaktu.waktu_main > 0)
                {
                    GameObject.Find("posisiBola").SendMessage("buat_bola_baru");
                    GameObject.Find("Main Camera").SendMessage("refreshBar");
                    powerX     = 1650f;
                    addPowX    = 0;
                    kemiringan = 0;
                    delayShoot = 2;
                }
            }
        }
    }
Exemplo n.º 3
0
    public void score_tambah()
    {
        scriptRingIn = GameObject.Find("ring_in").GetComponent <sc_ringin>();

        //stat3Point
        sc_waktu scriptWaktu = GameObject.Find("txtWaktu").GetComponent <sc_waktu>();

        if (scriptWaktu.waktu_main > 0)
        {
            if (scriptWaktu.stat3Point == false)
            {
                //score+=2+scriptRingIn.tambahPoint;
                score += 2;
            }
            else
            {
                //score+=3+scriptRingIn.tambahPoint;
                score += 3;
            }
        }
        //this.guiText.text = score_empat_digit(score);
        textScore.text = score_empat_digit(score);
    }