Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

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.

$
0
0
Animator anim; AudioSource enemyAudio; ParticleSystem hitParticles; CapsuleCollider capsuleCollider; bool isDead; bool isSinking; void Awake () { anim = GetComponent (); enemyAudio = GetComponent (); hitParticles = GetComponentInChildren (); capsuleCollider = GetComponent (); currentHealth = startingHealth; } void Start () { mengambil = GameObject.FindWithTag ("Enemy").GetComponent (); } 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 ().enabled = false; GetComponent ().isKinematic = true; isSinking = true; //ScoreManager.score += scoreValue; Destroy (gameObject, 2f); } }

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>