示例#1
0
    private void Start()
    {
        currentJellyfier       = FindObjectOfType <Jellyfier>();
        currentJellyGameObject = currentJellyfier.gameObject;
        currentRotate          = currentJellyGameObject.GetComponent <Rotate>();

        SetupButtons();
    }
示例#2
0
    private void ChangeMesh()
    {
        Destroy(currentJellyGameObject);
        currentJellyGameObject = Instantiate(prefabs[meshes.value]);
        currentJellyfier       = currentJellyGameObject.GetComponent <Jellyfier>();
        currentRotate          = currentJellyGameObject.GetComponent <Rotate>();
        materials.value        = 0;
        pressure.value         = meshes.value == 0 ? 2f : .04f;
        pressure.minValue      = meshes.value == 0 ? 1f : .001f;
        pressure.maxValue      = meshes.value == 0 ? 10f : .5f;

        Camera.main.GetComponent <MouseInput>().pressureForce = pressure.value;
        axis.value          = (int)currentRotate.axis;
        rotationSpeed.value = currentRotate.speed;
    }
示例#3
0
    private void Update()
    {
        if (Input.GetMouseButton(0))
        {
            mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);

            //We need to check if we are clicking on a mesh we can deform
            if (Physics.Raycast(mouseRay, out raycastHit))
            {
                Jellyfier jellyfier = raycastHit.collider.GetComponent <Jellyfier>();
                if (jellyfier != null)
                {
                    Vector3 inputPoint = raycastHit.point + (raycastHit.normal * pressureOffset);
                    jellyfier.ApplyPressureToPoint(inputPoint, pressureForce);
                }
            }
        }
    }
示例#4
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if (Physics.Raycast(ray, out hit))
         {
             Transform selection          = hit.transform;
             Jellyfier selectionJellyfier = selection.GetComponent <Jellyfier>();
             if (selectionJellyfier != null)
             {
                 selectionJellyfier.ApplyPressureToPoint(selection.position, force);
                 GameObject obj = Instantiate(new GameObject(selection.position.ToString()));
                 obj.transform.position = selection.position;
             }
         }
     }
 }
示例#5
0
 // Start is called before the first frame update
 void Start()
 {
     r = GetComponent <Jellyfier>();
 }