Example #1
0
 private bool stringExists(Vector3 s, Vector3 e)
 {
     for (int i = 0; i < stringSet.Count; i++)
     {
         StringCord str = stringSet[i].GetComponent <StringCord>();
         if (str.start == s && str.end == e)
         {
             return(true);
         }
         if (str.start == e && str.end == s)
         {
             return(true);
         }
     }
     return(false);
 }
Example #2
0
    private void createString(Vector3 s, Vector3 e)
    {
        Vector3 pos = Vector3.Lerp(s, e, 0.5f);

        GameObject stringInstance = Instantiate(stringObject, pos, Quaternion.identity);

        stringInstance.transform.LookAt(e);
        stringInstance.transform.localScale += new Vector3(0, Vector3.Distance(s, e) * 50, 0);
        stringInstance.transform.Rotate(-90, 0, 0);

        StringCord component = stringInstance.GetComponent <StringCord>();

        component.init(s, e);

        addString(stringInstance);
    }