Esempio n. 1
0
        public override bool DrawMe(Transform parent, VainDrawer drawinfo)
        {
            // Check if the vain is already drawn. If it is drawn already, skip creating the object
            if (!isDrawn)
            {
                // Get the next available object from the object pool
                //this.obj = ObjectPool.GetInstance().GetObject(this.GetType());
                this.obj = ObjectPool.INSTANCE.GetNext(this.GetType());
                this.obj.SetActive(true);

                // Set the parent of the object to the VainBuilder
                this.obj.transform.parent = parent;

                this.obj.name = this.id.ToString();

                // Set the scale of the object
                this.obj.transform.localScale = new Vector3(this.scale, this.scale, this.scale);

                //// Set the flip of the object
                //for (int i = 0; i < this.obj.transform.childCount; i++)
                //{
                //    this.obj.transform.GetChild(i).eulerAngles = new Vector3(0, 0, 0);
                //}

                // Remember that the vain is now drawn
                this.isDrawn = true;

                // Set the position and rotation of the vain
                if (!drawinfo.IsEmpty())
                    this.SetPosition(drawinfo);
            }

            // Return true if the vain has a second exit
            return this.HasSecondExit();
        }
Esempio n. 2
0
        protected override void SetPosition(VainDrawer drawinfo)
        {
            // Apply the rotation before calculations
            this.obj.transform.eulerAngles = drawinfo.ExitRotation;
            this.obj.transform.position = drawinfo.ExitPosition;

            // Caculate the centerpoint of the of this vain
            Vector3 VainExit = new Vector3();
            if (drawinfo.DestinationExit == 0)
            {
                VainExit = new Vector3(this.obj.transform.position.x, this.obj.transform.position.y, this.obj.transform.position.z);
            }
            else if (drawinfo.DestinationExit == 1)
            {
                VainExit = new Vector3(this.obj.transform.position.x, this.obj.transform.position.y, this.obj.transform.position.z + (size.z * this.scale));
            }

            // Check if there is a differance between the 2 coordinates
            Vector3 delta = drawinfo.ExitPosition - VainExit;
            if (delta.x == 0 && delta.y == 0 && delta.z == 0)
            {
                // Apply the new position to the vain
                this.obj.transform.position = VainExit;
            }
            else
            {
                this.obj.transform.position = drawinfo.ExitPosition + delta;
            }
        }
Esempio n. 3
0
 public override bool DrawMe(Transform parent, VainDrawer drawinfo)
 {
     this.scale = 4f;
     return base.DrawMe(parent, drawinfo);
 }