public SmartMaterial GetStaticMaterial() { if (staticMaterial == null || staticMaterial.material == null) { staticMaterial = MaterialManager.GetVertexLitCopy(); staticMaterial.SetColor(Color.black); } return(staticMaterial); }
void Start() { Vector2D position = new Vector2D(anchorBody.transform.position); material = MaterialManager.GetSpriteCopy().material; texture = Resources.Load("Sprites/Rope/SmallRope") as Texture; material.mainTexture = texture; GameObject prev = anchorBody; int ropeId = 1; GameObject gObject = null; float distance = 1.5f; while (Vector2D.Distance(position, new Vector2D(connectedBody.transform.position)) > distance) { double direction = Vector2D.Atan2(new Vector2D(connectedBody.transform.position), position); gObject = new GameObject(); HingeJoint2D hingeJoint = gObject.AddComponent <HingeJoint2D>(); hingeJoint.connectedBody = prev.GetComponent <Rigidbody2D>(); gObject.transform.parent = transform; gObject.transform.position = position.ToVector2(); gObject.name = "Rope " + ropeId; //gObject.AddComponent<JointRenderer2D> ().color = color; gObject.AddComponent <CircleCollider2D> ().radius = .25f; nodes.Add(hingeJoint); position.Push(direction, distance); prev = gObject; ropeId++; } if (gameObject != null) { HingeJoint2D joint = gObject.AddComponent <HingeJoint2D>(); joint.connectedBody = connectedBody.GetComponent <Rigidbody2D>(); nodes.Add(joint); } }
public Material GetFillMaterial() { if (customMaterial) { return(customFillMaterial); } else { if (fillMaterial == null) { fillMaterial = MaterialManager.GetVertexLitCopy(); } fillMaterial.SetColor(slicerColor); return(fillMaterial.material); } }
public Material GetBorderMaterial() { if (customMaterial) { return(customBoarderMaterial); } else { if (boarderMaterial == null) { boarderMaterial = MaterialManager.GetVertexLitCopy(); } boarderMaterial.SetColor(Color.black); return(boarderMaterial.material); } }
void Start() { lineMaterial = MaterialManager.GetVertexLitCopy(); lineMaterialBorder = MaterialManager.GetVertexLitCopy(); }