31 lines
627 B
C#
31 lines
627 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.AI;
|
|
|
|
public class Rotate : MonoBehaviour //mendefinisikan kelas bernama Rotate
|
|
{
|
|
|
|
bool isRotate;
|
|
public float rotatespeed;
|
|
|
|
public void ActivateRotation()
|
|
{
|
|
if (isRotate) //mematikan tombol rotate yg aktif
|
|
{
|
|
isRotate = false;
|
|
}
|
|
else //menghidupkan
|
|
{
|
|
isRotate = true;
|
|
}
|
|
}
|
|
//agar berputarnya di 1 titik Y (0,1,0)
|
|
void Update()
|
|
{
|
|
if (isRotate)
|
|
{
|
|
transform.Rotate(0,1,0, Space.Self);
|
|
}
|
|
}
|
|
} |