MIF_E31211986/Assets/Script/ScalingScript.cs

35 lines
632 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ScalingScript : MonoBehaviour
{
private bool isScale;
private float scaleSpeed;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (isScale)
{
transform.localScale += Vector3.one * scaleSpeed * Time.deltaTime;
}
}
public void ScaleObject(float speed)
{
isScale = true;
scaleSpeed = speed;
}
public void Stop()
{
isScale = false;
}
}