Beispiel #1
0
        public void GenerateBarWithAnimTypeTwo(int xIndex, int zIndex, float yValue, float scaleFactor, float animSpeed, int ymin, int xMax, Material barMaterial)
        {
            if (barRef == null)
            {
                return;
            }

            GameObject bar = GameObject.Instantiate(barRef, transform.position, transform.rotation);

            bar.transform.parent = ListOfGroups[zIndex].transform;
            //Vector3 pos = new Vector3(ListOfXPoint[xIndex].transform.position.x, 0, ListOfZPoints[zIndex].transform.position.z);
            // Debug.Log("Yes I am calling -----");
            Vector3 pos = new Vector3(ListOfXPoint[xIndex].transform.localPosition.x, 0, 0);

            bar.transform.localPosition = pos;
            bar.transform.localScale    = bar.transform.localScale * graphScaleFactor;

            BarProperty barProperty = bar.GetComponent <BarProperty>();

            SetBarProperties(barProperty);
            if (barMaterial != null)
            {
                barProperty.SetBarMat(barMaterial);
            }
            barProperty.SetBarLabel(yValue.ToString(), graphScaleFactor);

            float yscale = (yValue - ymin) * scaleFactor;

            bar.transform.localScale = new Vector3(bar.transform.localScale.x, yscale, bar.transform.localScale.z);

            ListOfGroups[zIndex].ListOfBar.Add(bar);
        }
        public IEnumerator GenerateGraphBarWithAnimTypeOne(int xIndex, int zIndex, float yValue, float scaleFactor, float animSpeed, int ymin, int xMax, Material barMaterial)
        {
            if (barRef == null)
            {
                yield return(null);
            }

            barParent.transform.localScale = Vector3.one;
            GameObject bar = GameObject.Instantiate(barRef, transform.position, transform.rotation);

            bar.transform.parent = ListOfGroups[zIndex].transform;
            //Vector3 pos = new Vector3(ListOfXPoint[xIndex].transform.position.x, 0, ListOfZPoints[zIndex].transform.position.z);
            // Debug.Log("Yes I am calling -----");
            Vector3 pos = new Vector3(ListOfXPoint[xIndex].transform.localPosition.x, 0, 0);

            bar.transform.localPosition = pos;
            bar.transform.localScale    = bar.transform.localScale * graphScaleFactor;



            ListOfGroups[zIndex].ListOfBar.Add(bar);

            BarProperty barProperty = bar.GetComponent <BarProperty>();

            SetBarProperties(barProperty);
            if (barMaterial != null)
            {
                barProperty.SetBarMat(barMaterial);
            }

            float yscale = (yValue - ymin) * scaleFactor;

            yield return(StartCoroutine(AnimateBarsWithAnimTypeOne(bar.GetComponent <BarProperty>(), yscale, yValue, animSpeed, false)));

            yield return(new WaitForEndOfFrame());
        }