コード例 #1
0
        public virtual void CreateMesh(UnitCarrier carrier)
        {
            if (uv == null)
            {
                return;
            }
            if (uv.Length != 4)
            {
                return;
            }
            var   vertex = carrier.vertex;
            int   s      = vertex.Count;
            float lx     = size.x * -pivot.x;
            float rx     = lx + size.x;

            lx *= localScale.x;
            rx *= localScale.x;
            float dy = size.y * -pivot.y;
            float ty = dy + size.y;

            dy *= localScale.y;
            ty *= localScale.y;

            Vector3 v = Vector3.zero;

            v.x = lx;
            v.y = dy;
            v   = localRotate * v + localPosition;
            vertex.Add(v);
            v.x = lx;
            v.y = ty;
            v   = localRotate * v + localPosition;
            vertex.Add(v);
            v.x = rx;
            v.y = ty;
            v   = localRotate * v + localPosition;
            vertex.Add(v);
            v.x = rx;
            v.y = dy;
            v   = localRotate * v + localPosition;
            vertex.Add(v);
            carrier.uv.AddRange(uv);
            for (int i = 0; i < 4; i++)
            {
                carrier.colors.Add(color);
            }
            var tris = carrier.tris;

            tris.Add(s);
            tris.Add(s + 1);
            tris.Add(s + 2);
            tris.Add(s);
            tris.Add(s + 2);
            tris.Add(s + 3);
        }
コード例 #2
0
 public override void CreateMesh(UnitCarrier carrier)
 {
     if (createMesh != null)
     {
         createMesh(carrier);
     }
     else
     {
         base.CreateMesh(carrier);
     }
 }
コード例 #3
0
ファイル: UnitCollision.cs プロジェクト: pkwzsqsdly/HGUI
        public static void Add(UnitCarrier one, UnitCarrier other)
        {
            if (contexts2 == null)
            {
                contexts2 = new List <Context2>();
            }
            Context2 context = new Context2();

            context.Self  = one;
            context.Other = other;
            contexts2.Add(context);
        }
コード例 #4
0
ファイル: UnitCollision.cs プロジェクト: pkwzsqsdly/HGUI
        public static void Add(Unit one, UnitCarrier other)
        {
            if (contexts1 == null)
            {
                contexts1 = new List <Context1>();
            }
            Context1 context = new Context1();

            context.Self  = one;
            context.Other = other;
            contexts1.Add(context);
        }