using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseDown_Hide : MonoBehaviour
{
// 마우스 클릭했을 때 오브젝트가 사라진다.
private void OnMouseDown()
{
gameObject.SetActive(false);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseDown_Rotate : MonoBehaviour
{
float rotateAngle = 0; // 회전각도
private void OnMouseDown() // 마우스 클릭했을때
{
rotateAngle = 360;
}
private void OnMouseUp() // 마우스에서 손을 땠을 때
{
rotateAngle = 0;
}
private void FixedUpdate()
{
transform.Rotate(0, 0, rotateAngle/50);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseDown_Roulette : MonoBehaviour
{
public float maxSpeed = 50; // 최대속도
float speed = 0; // 오브젝트의 속도
private void OnMouseDown()
{
// 마우스클릭했을 때는 최대속도를 낸다.
speed = maxSpeed;
}
private void FixedUpdate()
{
speed *= (float)0.97; // 스피드를 조금씩 줄여서
transform.Rotate(0, 0, speed); // 회전한다.
}
}