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); }
public override void CreateMesh(UnitCarrier carrier) { if (createMesh != null) { createMesh(carrier); } else { base.CreateMesh(carrier); } }
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); }
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); }