Advertisement
Baoulettes

Coins rotation in GnomLand

Aug 14th, 2015
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.50 KB | None | 0 0
  1. /*****************
  2. /    Coins AI
  3. / Library to load
  4. /*****************/
  5.  
  6. using UnityEngine;
  7. using UnityEngine.UI;
  8. using System.Collections;
  9. using MadLevelManager;
  10.  
  11. //Public Mean I can access via other script.
  12. //class that to tell that a class aka "block of data & function"
  13. //Coins is actually the name of my .cs file and class.
  14. //MonoBehaviour is to tell Unity that I use it's code :)
  15. public class Coins : MonoBehaviour {
  16.  
  17.     //void is set to create class for "function" there.
  18.     //Update() is name of the function that constantly run. (no need to call it.)
  19.     void Update() {
  20.  
  21.         //Adding a function name that way would mean to Execute it Here Now.
  22.         RotateTheCoin();
  23.     }
  24.  
  25.     //Void as always create a function.
  26.     //RotateTheCoin() is the name of the function.
  27.     //Custom name is a function to call later. So if no call is made the code will not execute.
  28.     void RotateTheCoin() {
  29.  
  30.         //transform mean I will use the main class "transform" from one of my library
  31.         //(mean i will move or scale or rotate.)
  32.         //Rotate is the actual function to use.
  33.         //"(" ")" are there to set params of the function.
  34.         //Vector3 Is there to tell we use Axes system ( X Y Z )
  35.         //in the Vector3 we use "up" so we will use Y in positive way
  36.         //" * " is a multiplier sign to tell we rotate it with a power of
  37.         //and "5" is actually the power used to rotate "Script" Holder by 5 on the axe Y in a positive way.
  38.         transform.Rotate(Vector3.up * 5);
  39.     }
  40. }
  41.  
  42. //So basicly this script try to rotate a mesh that hold the script.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement