Accessing a Javascript from C# Script, Converting 3 Lines issue - Greatly Appreciated

Hi guys,

I’m attempting to make an achievement system for my game using this tutorial:http://cgcookie.com/unity/2011/12/16/creating-an-achievement-system/

My only issue is that it adds a line of code to his own personal character movement in which is written in javascript, mine however is written in C#.

What im asking is if you could help me convert this simple few lines of code and then explain HOW i am going to use the combiniation of C# and javascript in my game; is it merely ensuring there in different folders so that they can be processed at different times?

if any more information is needed just ask :slight_smile:

Movement Script Added to Player Controller:

var achievementManagerScript:AchievementManagerScript;

if (Input.GetAxis("Horizontal") || Input.GetAxis("Vertical"))
{
	achievementManagerScript.playerMoved();
}

Achievement Manager Script (currently java needs to be accessed by C# i…e above):

var FirstStepTex:Texture;

private var firstStepTaken:boolean;
var edgeMargin;

function start()
{
	edgeMargin = Screen.width * 0.1;
}

function playerMoved()
{
	if(!firstStepTaken)
	{
		Debug.log("Achievement_Awarded");
		UnlockAchievement(FirstStepTex);
		firstStepTaken = true;
	}
}

function UnlockAchievement(achievementTex:Texture)
{
	var go:GameObject = new GameObject("Achievement Object");
	go.transform.position = Vector3(0,0,0);
	go.transform.localScale = Vector3(0,0,0);
	
	var guitex:GUITexture = go.AddComponent(GUITexture);
	guitex.texture = achievementTex;
	guitex.pixelInset.width = achievementTex.width;
	guitex.pixelInset.height = achievementTex.height;
	guitex.pixelInset.x = Screen.width * 1.1;	//Screen.width - achievementTex.width - edgeMargin;
	guitex.pixelInset.y = Screen.height - achievementTex.height - edgeMargin;
	
	var achievementScript:AchievementScript= go.AddComponent(AchievementScript);
	achievementScript.edgeMargin = edgeMargin;
}

Achievement Script, accessed by the Achievement Manager:

var State:int = 0; // 0 = Scroll Left, 1 = Scroll Right
var scrollSpeed:float = 300;
var showAchievementTime:float = 3;

private var targetX:float;
private var outofScreenX:float; 
private var guitex:GUITexture;

var edgeMargin:float;

function Start()
{
	guitex = GetComponent(GUITexture);
	outofScreenX = guitex.pixelInset.x;
	targetX = Screen.width - guitex.texture.width - edgeMargin;
	
	yield WaitForSeconds(showAchievementTime);
	
	State = 1;
	
	yield WaitForSeconds(showAchievementTime);
	
	Destroy(gameObject);
}

function Update()
{ 
	if (State == 0) // Scroll Left
	{
		guitex.pixelInset.x = Mathf.MoveTowards(guitex.pixelInset.x, targetX, scrollSpeed * Time.deltaTime);
	}
	else {
		guitex.pixelInset.x = Mathf.MoveTowards(guitex.pixelInset.x, outofScreenX, scrollSpeed * Time.deltaTime);
	}
}

if you could help itd be greatly appreciated!

bump