void Start()
        {
            m_Fill  = GetComponent <Image>();
            m_Value = 0;
            SetFillerSize(0);

            instance = this;
        }
        public static ProgressRadialBehaviour Instance()
        {
            if (instance == null)
            {
                instance = new ProgressRadialBehaviour();
            }

            return(instance);
        }
Esempio n. 3
0
 public void createTimer()
 {
     _timerPanel = Instantiate(_prefabTimerPanel);
     _timerPanel.transform.parent        = gameObject.transform;
     _timerPanel.transform.localPosition = new Vector3(0, 150, 0);
     _timerPanel.transform.localScale    = new Vector3(1, 1, 1);
     _progressRadialHollow = Instantiate(_prefabProgressBar).GetComponent <ProgressBar.ProgressRadialBehaviour>();
     _progressRadialHollow.transform.parent = _timerPanel.transform;
     _progressRadialHollow.GetComponent <RectTransform>().position   = gameObject.transform.position;
     _progressRadialHollow.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1);
     _timerPanel.transform.GetChild(1).gameObject.AddComponent <PlayPauseTimer>();
     _timerPanel.transform.GetChild(2).gameObject.AddComponent <RestartTimer>();
 }
	// Use this for initialization
	void Start () 
	{

		dashButton = dashButtonGUI.GetComponentInChildren<ProgressRadialBehaviour>();
		dashButton.ProgressSpeed = dashProgressSpeed;
		dashButton.IncrementValue(100f);

		attackButton = attackButtonGUI.GetComponentInChildren<ProgressRadialBehaviour>();
		attackButton.ProgressSpeed = attackProgressSpeed;
		attackButton.IncrementValue(100f);

		shootButton = shootButtonGUI.GetComponentInChildren<ProgressRadialBehaviour>();
		shootButton.ProgressSpeed = shootProgressSpeed;
		shootButton.IncrementValue(100f);

		jumpButton = jumpButtonGUI.GetComponentInChildren<ProgressRadialBehaviour>();
		jumpButton.ProgressSpeed = jumpProgressSpeed;
		jumpButton.IncrementValue(100f);

		shrinkMeter = ShrinkMeterGUI.GetComponent<ProgressBarBehaviour>();
		shrinkMeter.ProgressSpeed = shrinkProgressSpeed;
		shrinkMeter.IncrementValue(100f);

	}
	// Use this for initialization
	void Start () {
		BODY = GetComponent<Rigidbody>();
		proRadB = GameObject.Find ("ProgressRadialHollow").GetComponent<ProgressBar.ProgressRadialBehaviour>();
		
	}
Esempio n. 6
0
 // Use this for initialization
 void Start()
 {
     BODY    = GetComponent <Rigidbody>();
     proRadB = GameObject.Find("ProgressRadialHollow").GetComponent <ProgressBar.ProgressRadialBehaviour>();
 }
    public IEnumerator SomeFunction(string gameObjectName)
    {
        _myMaterial = new Material(Shader.Find("Diffuse"));

        GameObject obj_gameobject = GameObject.Find(gameObjectName);

        Debug.Log("started parsing the obj...");
        initArrayLists();
        // re-initialize the mesh and name it
        if (_myMesh != null)
        {
            _myMesh.Clear();
        }
        _myMesh      = new Mesh();
        _myMesh.name = _meshName;

        CanvasGroup canvasGroup = GetComponentInChildren <CanvasGroup> ();

        canvasGroup.alpha = 1;
        // Draws the rotating loading spinner
        ProgressBar.ProgressRadialBehaviour progressBar = (ProgressBar.ProgressRadialBehaviour)GetComponentInChildren <ProgressBar.ProgressRadialBehaviour> ();
        // retrieve data from OBJ file
        WWW www3d = new WWW(_textFieldString);

        while (!www3d.isDone)
        {
            //Debug.Log("Set value: " + www3d.progress);
            progressBar.SetValue(www3d.progress * 100);
            yield return(null);
        }
        if (!string.IsNullOrEmpty(www3d.error))
        {
            // error!
        }
        else
        {
            progressBar.TriggerOnComplete = true;
        }
        yield return(www3d);

        string s = www3d.text;

        //replace double spaces and dot-notations
        s = s.Replace("  ", " ");
        s = s.Replace("  ", " ");
        //~ s = s.Replace(".", ",");
        // call loadFile() and pass through the data from the OBJ file --> here we load the OBJ
        LoadFile(s);
        canvasGroup.alpha = 0;
        progressBar.ResetValue();
        Debug.Log("File loaded");
        //set the vertices and triangles to the unity mesh
        _myMesh.vertices  = _vertexArray;
        _myMesh.triangles = _triangleArray;
        if (_uvArrayList.Count > 0)
        {
            _myMesh.uv = _uvArray;
        }
        if (_normalArrayList.Count > 0)
        {
            _myMesh.normals = _normalArray;
        }
        else
        {
            _myMesh.RecalculateNormals();
        }
        //calculate the bounds
        _myMesh.RecalculateBounds();
        // check if there is allready a MeshFilter present, if not add one
        if ((MeshFilter)obj_gameobject.GetComponent("MeshFilter") == null)
        {
            obj_gameobject.AddComponent <MeshFilter>();
        }
        //assign the mesh to the meshfilter
        MeshFilter temp;

        temp      = (MeshFilter)obj_gameobject.GetComponent("MeshFilter");
        temp.mesh = _myMesh;

//		obj_gameobject.GetComponent<MeshRenderer> ().enabled = true;

        if ((MeshRenderer)obj_gameobject.GetComponent("MeshRenderer") == null)
        {
            obj_gameobject.AddComponent <MeshRenderer>();
        }
        // retrieve the texture
        Debug.Log("uv arraylist count: " + _uvArrayList.Count + " Texture link: " + _textureLink);
        if (_uvArrayList.Count > 0 && _textureLink != "")
        {
            WWW wwwtx = new WWW(_textureLink);
            yield return(wwwtx);

            Debug.Log("Loading texture");
            _myMaterial.mainTexture = wwwtx.texture;
        }
        // assign the texture to the meshrenderer
        MeshRenderer temp2;

        temp2 = (MeshRenderer)obj_gameobject.GetComponent("MeshRenderer");
        if (_uvArrayList.Count > 0 && _textureLink != "")
        {
            temp2.material     = _myMaterial;
            _myMaterial.shader = Shader.Find("Diffuse");
        }

        yield return(new WaitForFixedUpdate());
    }