Upload from upload_mods.ps1
This commit is contained in:
29
KFAttached/FPSPack/FPSRandomRotateAngle.cs
Normal file
29
KFAttached/FPSPack/FPSRandomRotateAngle.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class FPSRandomRotateAngle : MonoBehaviour
|
||||
{
|
||||
public bool RotateX;
|
||||
public bool RotateY;
|
||||
public bool RotateZ = true;
|
||||
|
||||
private Transform t;
|
||||
|
||||
// Use this for initialization
|
||||
void Awake()
|
||||
{
|
||||
t = transform;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void OnEnable()
|
||||
{
|
||||
var rotateVector = Vector3.zero;
|
||||
if (RotateX)
|
||||
rotateVector.x = Random.Range(0, 360);
|
||||
if (RotateY)
|
||||
rotateVector.y = Random.Range(0, 360);
|
||||
if (RotateZ)
|
||||
rotateVector.z = Random.Range(0, 360);
|
||||
t.Rotate(rotateVector);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user