I tried to translate from c# to java a cheat code system and I combine the cheat code system into the cloud system, so when i input the code, the sky is changing the appearance and if I write the code again, the sky is changing back to normal. The cheat code system is in Update and Start. The problem is I have many error logs in unity. Here is the script:
var Player : Transform;
var CloudsSpeed = 1.75;
private var distance = 10.0;
private var height = 0;
private var heightDamping = 0;
private var rotationDamping = 0;
var zero : boolean = false;
var rend: Renderer;
private var string[] cheatCode;
private var index : int;
function Start ()
{
rend = GetComponent.<Renderer>();
cheatCode = new string[] { "c", "r", "a", "z", "y", "w" "o", "r", "l", "d" };
index = 0;
}
function Update()
{
transform.Rotate(0,Time.deltaTime*CloudsSpeed ,0);
if (Input.anyKeyDown)
{
if (Input.GetKeyDown(cheatCode[index]))
{
index++
}
else
{
index = 0;
}
if (index == cheatCode.Length)
{
if (zero)
zero = false;
else
zero = true;
if(zero)
{
rend.material.mainTextureScale = Vector2 (5,25);
CloudsSpeed = 3;
}
else
{
rend.material.mainTextureScale = Vector2 (1,1);
CloudsSpeed = 1.75;
}
}
}
function LateUpdate ()
{
if (!Player)
return;
var wantedHeight = Player.position.y + height;
var currentHeight = transform.position.y;
currentHeight = Mathf.Lerp (currentHeight, wantedHeight, heightDamping * Time.deltaTime);
transform.position = Player.position;
transform.position.y = currentHeight;
}
What I can change in this script?
Please help me!