Esempio n. 1
0
    public void StartDrawing(Vector3 position, Quaternion rotation)
    {
        startPosition = position;
        GameObject go = Instantiate(objectCursor, Vector3.zero, Quaternion.identity) as GameObject;

        objectCursor.SetActive(false);

        if (objectType == ObjectType.Shape)
        {
            shape = go.GetComponent <ProcShape>();
            shape.ResetPoint(GridSnapTool.Snap(position), transform.rotation.eulerAngles.x);

            // checks if there is a mirror -> make a copy
            if (ms.gameObject.activeSelf)
            {
                ms.CreateReflection(go, scene.transform);
                ms.reflection.transform.position = go.transform.position;
                ms.reflection.GetComponent <ProcShape>().startPoint = ms.ReflectPoint(GridSnapTool.Snap(position));
            }
        }
        if (objectType == ObjectType.Section)
        {
            section = go.GetComponent <ProcSection>();
            section.ResetPoint(GridSnapTool.Snap(position), transform.rotation.eulerAngles.x);

            // checks if there is a mirror -> make a copy
            if (ms.gameObject.activeSelf)
            {
                ms.CreateReflection(go, scene.transform);
                ms.reflection.transform.position = go.transform.position;
                ms.reflection.GetComponent <ProcSection>().startPoint = ms.ReflectPoint(GridSnapTool.Snap(position));
            }
        }
        if (objectType == ObjectType.Hair)
        {
            go = Instantiate(Resources.Load("HairSplineTrail"), new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
            go.GetComponent <HairSplineTrail>().Init(hairObject);
            hair = go.GetComponent <ProcHair>();
            hair.ResetPoint(GridSnapTool.Snap(position), transform.rotation.eulerAngles.x);

            // checks if there is a mirror -> make a copy
            if (ms.gameObject.activeSelf)
            {
                ms.CreateReflection(go, scene.transform);
                ms.reflection.transform.position = go.transform.position;
                ms.reflection.GetComponent <ProcHair>().startPoint = ms.ReflectPoint(GridSnapTool.Snap(position));
            }
        }
    }
Esempio n. 2
0
 public void StartDrawing()
 {
     if (objectType == ObjectType.Shape)
     {
         go = Instantiate(Resources.Load("ShapeSplineTrail"), new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
         go.GetComponent <ShapeSplineTrail>().Init(shapeObject);
         StartPoint = GridSnapTool.Snap(shapeObject.transform.position);
         // checks if there is a mirror -> make a copy
         if (ms.gameObject.activeSelf)
         {
             ms.CreateReflection(go, scene.transform);
             ms.reflection.GetComponent <ShapeSplineTrail>().Init(shapeObject);
         }
     }
     else if (objectType == ObjectType.Section)
     {
         go = Instantiate(Resources.Load("SectionSplineTrail"), new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
         go.GetComponent <SectionSplineTrail>().Init(sectionObject);
         StartPoint = GridSnapTool.Snap(sectionObject.transform.position);
         // checks if there is a mirror -> make a copy
         if (ms.gameObject.activeSelf)
         {
             ms.CreateReflection(go, scene.transform);
             ms.reflection.GetComponent <SectionSplineTrail>().Init(sectionObject);
         }
     }
     else if (objectType == ObjectType.Hair)
     {
         go = Instantiate(Resources.Load("HairSplineTrail"), new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
         go.GetComponent <HairSplineTrail>().Init(hairObject);
         StartPoint = GridSnapTool.Snap(hairObject.transform.position);
         // checks if there is a mirror -> make a copy
         if (ms.gameObject.activeSelf)
         {
             ms.CreateReflection(go, scene.transform);
             ms.reflection.GetComponent <HairSplineTrail>().Init(hairObject);
         }
     }
 }