Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

hamid.rdt

Newbie
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

0 Neutral

About hamid.rdt

  • Rank
    Newbie

Profile Information

  • Gender
    Male
  • Location:
    usa ghjjfhsdgdg
  1. fix it ! in the my project sitting\ time : time scale is 0 change this to 1 and fix it
  2. print ("Test"); and Any code after yield return new WaitForSeconds(3);
  3. Hello my freinds on this code , yeild not work in my unity 4.6 but on unity 5 or other version working correctly!!!!!!! using UnityEngine; using System.Collections; public class PreloadSceneProgressBar : MonoBehaviour { void Update() { if(Input.GetButtonDown("Fire")){ print ("Fire"); StartCoroutine(OutOfAmmo()); } } IEnumerator OutOfAmmo() { yield return new WaitForSeconds(3); print ("Test"); } } after yield commond not work! (on unity 5 or other version working correctly)! please help me
  4. thank you for reply I did change but The error remains
  5. using UnityEngine; using System.Collections; #pragma warning disable 0219 #pragma warning disable 0414 [ExecuteInEditMode] public class PlayerDamageNew : MonoBehaviour { /** * Script written by OMA [www.armedunity.com] **/ public float hitPoints; public int regenerationSkill; public int shieldSkill; public AudioClip painSound; public AudioClip die; public Transform deadReplacement; public GUISkin mySkin; public GameObject explShake; private GameObject radar; public float maxHitPoints; public Texture damageTexture; private float time = 0.0f; private float alpha; private bool callFunction = false; private ScoreManager scoreManager; void Start() { maxHitPoints = hitPoints; alpha = 0; } void Update() { if (time > 0) { time -= Time.deltaTime; } alpha = time; if (hitPoints <= maxHitPoints) { hitPoints += Time.deltaTime * regenerationSkill; } if (hitPoints > maxHitPoints) { float convertToScore = hitPoints - maxHitPoints; scoreManager = GameObject.Find("ScoreManager").GetComponent<ScoreManager>(); //scoreManager.addScore(convertToScore); hitPoints = maxHitPoints; } } void PlayerDamage(int damage) { if (hitPoints < 0.0f) return; damage -= shieldSkill; if (damage > 0) { // Apply damage hitPoints -= damage; audio.PlayOneShot(painSound, 1.0f / audio.volume); time = 2.0f; // Are we dead? if (hitPoints <= 0.0f) StartCoroutine(Die()); } else { damage = 0; } } //Picking up MedicKit void Medic(int medic) { hitPoints += medic; if (hitPoints > maxHitPoints) hitPoints = maxHitPoints; } IEnumerator Die() { if (callFunction) yield break; callFunction = true; if (die && deadReplacement) AudioSource.PlayClipAtPoint(die, transform.position); // Disable all script behaviours (Essentially deactivating player control) Component[] coms = GetComponentsInChildren<MonoBehaviour>(); foreach (var b in coms) { MonoBehaviour p = b as MonoBehaviour; if (p) p.enabled = false; } // Disable all renderers Renderer[] gos = GetComponentsInChildren<Renderer>(); foreach (Renderer go in gos) { go.enabled = false; } if (radar != null) { radar = GameObject.FindWithTag("Radar"); radar.gameObject.SetActive(false); } Instantiate(deadReplacement, transform.position, transform.rotation); yield return new WaitForSeconds(4.5f); //Destroy (transform.root.gameObject); } void OnGUI() { GUI.skin = mySkin; GUIStyle style1 = mySkin.customStyles[0]; GUI.Label(new Rect(40, Screen.height - 50, 60, 60), " Health: "); GUI.Label(new Rect(100, Screen.height - 50, 60, 60), "" + hitPoints.ToString("F0"), style1); GUI.color = new Color(1.0f, 1.0f, 1.0f, alpha); //Color (r,g,b,a) GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), damageTexture); } void Exploasion() { explShake.animation.Play("exploasion"); } } error on this line: Instantiate(deadReplacement, transform.position, transform.rotation); but deadReplacement transform wok in java script!
  6. i cant sloved this problem! all refrenced is ok! i have problem only C# version The referenced script on this Behaviour is missing! UnityEngine.Object:Instantiate(Object, Vector3, Quaternion) <Die>c__IteratorB:MoveNext() (at Assets/Resources/NewScripts/PlayerDamageNew.cs:122) UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) PlayerDamageNew:PlayerDamage(Int32) (at Assets/Resources/NewScripts/PlayerDamageNew.cs:75) UnityEngine.Component:SendMessageUpwards(String, Object, SendMessageOptions) <Start>c__Iterator23:MoveNext() (at Assets/Resources/OldScripts/WeaponScripts/ExplosionAdvanced.cs:33)
×
×
  • Create New...