Smooth Rotation Script

//********************************************************************//
//Company:Ayoku Animation
//Game Name:Space Schooner
//Script Name: goldRotation
//Script Purpose: Rotate the gold coins on one axis
//********************************************************************//

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class goldRotation : MonoBehaviour
{//Beginning of goldRotation Class

#region Settings
public float rotationSpeed = 99.0f;
public bool reverse = false;
#endregion

void Update()
{//beginning of update function

rotate();

}//end of update function

public void rotate()
{//beginning of rotate function

//if (this.reverse)
//transform.Rotate(Vector3.back * Time.deltaTime * this.rotationSpeed);
// transform.Rotate(new Vector3(0f, 0f, 1f) * Time.deltaTime * this.rotationSpeed);
//else
//transform.Rotate(Vector3.forward * Time.deltaTime * this.rotationSpeed);
transform.Rotate(new Vector3(0f, 0f, 1f) * Time.deltaTime * this.rotationSpeed);

}//end of rotate function

public void SetRotationSpeed(float speed)
{//beginning of SetRotationSpeed function

this.rotationSpeed = speed;

}//end of SetRotationSpeed function

public void SetReverse(bool reverse)
{//beginning of SetReverse function

this.reverse = reverse;

}//end of SetReverse function

}//End of goldRotation Class

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.