Question by
Kur4ta · Apr 08, 2017 at 05:11 AM ·
c#javascriptcompile
How Do I change this Script to be JS, Anyone can help me, Please. I am still newbie about Unity. i am doing to work on my thesis, Hopefully it's gonna be done. Thank you so much in Advanced.
Animator anim; AudioSource enemyAudio; ParticleSystem hitParticles; CapsuleCollider capsuleCollider; bool isDead; bool isSinking;
void Awake ()
{
anim = GetComponent <Animator> ();
enemyAudio = GetComponent <AudioSource> ();
hitParticles = GetComponentInChildren <ParticleSystem> ();
capsuleCollider = GetComponent <CapsuleCollider> ();
currentHealth = startingHealth;
}
void Start () {
mengambil = GameObject.FindWithTag ("Enemy").GetComponent<Spown> ();
}
void Update ()
{
if(isSinking)
{
transform.Translate (-Vector3.up * sinkSpeed * Time.deltaTime);
}
}
public void TakeDamage (int amount, Vector3 hitPoint)
{
if(isDead)
return;
enemyAudio.Play ();
currentHealth -= amount;
hitParticles.transform.position = hitPoint;
hitParticles.Play();
if(currentHealth <= 0)
{
Death ();
}
}
void Death ()
{
if (deadReplacement) {
Rigidbody dead = Instantiate(deadReplacement, GOPos.transform.position, GOPos.transform.rotation)as Rigidbody;
dead.rigidbody.velocity = rigidbody.velocity;
dead.angularVelocity = rigidbody.angularVelocity;
}
isDead = true;
capsuleCollider.isTrigger = true;
anim.SetTrigger ("Dead");
enemyAudio.clip = deathClip;
enemyAudio.Play ();
}
public void StartSinking ()
{
GetComponent <UnityEngine.AI.NavMeshAgent> ().enabled = false;
GetComponent <Rigidbody> ().isKinematic = true;
isSinking = true;
//ScoreManager.score += scoreValue;
Destroy (gameObject, 2f);
}
}
Comment
Converting from one language into another is not really unity related. Let mono help you.create a c# script, paste the code and look at the errors. Resolve them one after another.
Your answer
Follow this Question
Related Questions
Need help to put together 2 scripts 0 Answers
How to load level after typing somthing? 1 Answer
Jump Issue :( 1 Answer
SHA512 JS -> C# 0 Answers