29 lines
806 B
C#
29 lines
806 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class BigerObject : MonoBehaviour
|
|
{
|
|
public GameObject gameObjectToBigger;
|
|
public Slider thisSlider;
|
|
public Text setText;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
thisSlider = GetComponent<Slider>();
|
|
thisSlider.minValue = 1f;
|
|
thisSlider.maxValue = 5f;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
float scale = thisSlider.value;
|
|
gameObjectToBigger.transform.localScale = new Vector3(scale, scale, scale);
|
|
gameObjectToBigger.GetComponent<GetKuangparent>().fanWei=thisSlider.value*80;
|
|
setText.text = "缩放: " + scale.ToString("F2");
|
|
}
|
|
}
|