Exemplo n.º 1
0
        Task addTask(char ch, int count)
        {
            TaskList tl = new TaskList();

            tl.push(new TaskWait(0.15f));
            Task add = new TweenTask(delegate {
                VoxelChar vc = _create.create(ch);
                if (vc != null)
                {
                    vc.gameObject.SetActive(true);

                    vc.setLayer(this.gameObject.layer);
                    vc.gameObject.transform.SetParent(this.transform);

                    vc.gameObject.transform.localScale    = Vector3.one;
                    vc.gameObject.transform.localPosition = getOffset(count, chars_.Count);                    //ew Vector3(chars_.Count * _offset, 0, 0);
                    chars_.Add(vc);
                    vc.setMainColor(_maincolor);
                    vc.setLightColor(_lightColor);
                    vc.gameObject.transform.eulerAngles = new Vector3(-270, 0, 0);
                    return(TweenRotation.Begin(vc.gameObject, 0.15f, Quaternion.Euler(new Vector3(0, 0, 0))));
                }
                return(null);
            });



            tl.push(add);
            return(tl);
        }
Exemplo n.º 2
0
        public void setText(string text)
        {
            string comp = compress(text);
            int    n    = Mathf.Min(chars_.Count, comp.Length);

            for (int i = 0; i < n; ++i)
            {
                if (chars_[i].ch != comp[i])
                {
                    chars_[i].gameObject.SetActive(false);
                    VoxelChar vc = _create.create(comp[i]);
                    vc.gameObject.SetActive(true);
                    vc.setLayer(this.gameObject.layer);
                    vc.setMainColor(_maincolor);
                    vc.setLightColor(_lightColor);
                    vc.gameObject.transform.SetParent(this.transform);

                    vc.gameObject.transform.localScale = Vector3.one;
                    chars_[i] = vc;
                }
            }
            if (chars_.Count > comp.Length)
            {
                for (int i = n; i < chars_.Count; ++i)
                {
                    chars_[i].gameObject.SetActive(false);
                }
                chars_.RemoveRange(n, chars_.Count - n);
            }


            if (comp.Length > chars_.Count)
            {
                for (int i = n; i < comp.Length; ++i)
                {
                    VoxelChar vc = _create.create(comp[i]);
                    if (vc != null)
                    {
                        vc.gameObject.SetActive(true);
                        vc.setLayer(this.gameObject.layer);
                        vc.gameObject.transform.SetParent(this.transform);
                        vc.gameObject.transform.localScale = Vector3.one;
                        chars_.Add(vc);
                        vc.setMainColor(_maincolor);
                        vc.setLightColor(_lightColor);
                    }
                }
            }

            for (int i = 0; i < chars_.Count; ++i)
            {
                chars_[i].gameObject.transform.localPosition = getOffset(comp.Length, i);                //new Vector3(i * _offset, 0, 0);
            }
        }
Exemplo n.º 3
0
        Task changeTask(int i, char ch, int count)
        {
            TaskList tl = new TaskList();

            Task remove = new TweenTask(delegate {
                chars_[i].gameObject.transform.eulerAngles = new Vector3(0, 0, 0);
                return(TweenRotation.Begin(chars_[i].gameObject, 0.15f, Quaternion.Euler(new Vector3(270, 0, 0))));
            });

            TaskManager.PushBack(remove, delegate {
                chars_[i].gameObject.SetActive(false);
            });
            tl.push(remove);



            Task add = new TweenTask(delegate {
                VoxelChar vc = _create.create(ch);
                if (vc != null)
                {
                    vc.gameObject.SetActive(true);
                    vc.setLayer(this.gameObject.layer);
                    vc.setMainColor(_maincolor);
                    vc.setLightColor(_lightColor);
                    vc.gameObject.transform.SetParent(this.transform);

                    vc.gameObject.transform.localScale    = Vector3.one;
                    vc.gameObject.transform.localPosition = this.getOffset(count, i);
                    chars_[i] = vc;
                    vc.gameObject.transform.eulerAngles = new Vector3(-270, 0, 0);
                    return(TweenRotation.Begin(vc.gameObject, 0.15f, Quaternion.Euler(new Vector3(0, 0, 0))));
                }
                return(null);
            });



            tl.push(add);


            return(tl);
        }