using UnityEngine; using System.Collections; //控制有放缩弹一弹的效果 public class ScaleController : MonoBehaviour { bool ismax = false; public float scaleSpeed = 0.003f; //可调速度 public float scalemax=2, scalemin=1.5f; //可调范围 void Update () { Vector2 scale = transform.localScale; if (ismax==false) { scale.x += scaleSpeed; scale.y += scaleSpeed; transform.localScale = scale; if (scale.x>= scalemax) { ismax = true; } } else { scale.x -= scaleSpeed; scale.y -= scaleSpeed; transform.localScale = scale; if (scale.x <= scalemin) { ismax = false; } } } }
标签:scale,ismax,transform,放缩,Unity,弹一弹,scaleSpeed From: https://www.cnblogs.com/weigangblog/p/18206165