TKK_E32231768/Assets/6Script/control_planet.cs

35 lines
723 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class control_planet : MonoBehaviour
{
float x, y;
public GameObject bankplanet;
public int kontrol;
// Start is called before the first frame update
void Start()
{
x = transform.localScale.x;
y = transform.localScale.y;
}
void OnMouseDown()
{
GetComponent<AudioSource>().Play();
transform.localScale = new Vector2(x * 1.2f, y / 1.2f);
}
void OnMouseUp()
{
transform.localScale = new Vector2(x, y);
bankplanet.GetComponent<bank_planet>().control(kontrol);
}
// Update is called once per frame
void Update()
{
}
}