using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ModelScale : MonoBehaviour
{
private Vector3 suo = new Vector3(0.1f, 0.1f, 0.1f);
//模型的缩放系数
// Update is called once per frame
void Update()
{
if (this.transform.localScale.x > 6)
{
this.transform.localScale = this.transform.localScale - suo;
}
else if (this.transform.localScale.x < 6)
{
this.transform.localScale = this.transform.localScale + suo;
}
if (Mathf.Abs(this.transform.localScale.x - 6) < 0.01)
{
this.transform.localScale = new Vector3(6, 6, 6);
Destroy(this);//销毁自身这个脚本
}
}
}
using System.Collections.Generic;
using UnityEngine;
public class ModelScale : MonoBehaviour
{
private Vector3 suo = new Vector3(0.1f, 0.1f, 0.1f);
//模型的缩放系数
// Update is called once per frame
void Update()
{
if (this.transform.localScale.x > 6)
{
this.transform.localScale = this.transform.localScale - suo;
}
else if (this.transform.localScale.x < 6)
{
this.transform.localScale = this.transform.localScale + suo;
}
if (Mathf.Abs(this.transform.localScale.x - 6) < 0.01)
{
this.transform.localScale = new Vector3(6, 6, 6);
Destroy(this);//销毁自身这个脚本
}
}
}