示例#1
0
    void SizeCircleValueChanged()
    {
        CylinderBehavior cylinderBehavior = GameObject.Find("Cylinder").GetComponent <CylinderBehavior>();

        cylinderBehavior.Radius = SizeCircleSlider.value;
        cylinderBehavior.Resize();
    }
    // Start is called before the first frame update
    void Start()
    {
        audio  = GetComponent <AudioSource>();
        parent = transform.parent.GetComponent <CylinderBehavior>();

        lastFramePosition = transform.position;
    }
 void OnTriggerExit(Collider collision)
 {
     if (collision.gameObject.GetComponent <CylinderBehavior>() == selection)
     {
         selection = null;
         renderer.material.color = defaultColor;
     }
 }
 void OnTriggerEnter(Collider collision)
 {
     if (grabbedObject == null)
     {
         selection = collision.gameObject.GetComponent <CylinderBehavior>();
         if (selection != null)
         {
             renderer.material.color = new Color(selection.color.r, selection.color.g, selection.color.b, defaultColor.a);
         }
     }
 }
示例#5
0
    void NbTreesCreatedValueChanged()
    {
        CylinderBehavior cylinderBehavior = GameObject.Find("Cylinder").GetComponent <CylinderBehavior>();
        int newValue;

        if (NbTreesCreatedSlider.value == 0)
        {
            newValue = 1;
        }
        else if (NbTreesCreatedSlider.value == 1)
        {
            newValue = 10;
        }
        else
        {
            newValue = 50;
        }
        cylinderBehavior.NbTreesCreated = newValue;
    }
 private void SetGrabbing(CylinderBehavior grabbed)
 {
     grabbedObject    = grabbed;
     renderer.enabled = grabbedObject == null;
 }
 public void Initialize(Transform source, Vector3 anchor)
 {
     parent      = source;
     this.source = source.GetComponent <CylinderBehavior>();
     localAnchor = parent.InverseTransformPoint(anchor);
 }