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.

czshow35

Newbie
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

0 Neutral

About czshow35

  • Rank
    Newbie

Profile Information

  • Gender
    Male
  • Location:
    Turkiye
  1. Ok verry beatifful. Thanks. Player spawn delete ? (Player prefap in game put)
  2. czshow35

    Player don't dead

    Hello 1) Everything appears in the video zombie hits the player but the player does not die blood effect does not appear 2)do I remove a one player spawn system? video; Zombie Code; using UnityEngine; using System.Collections; public class ZombiZeka : MonoBehaviour { HealthScript playerCan; public int damage = 50; public Transform target; //the enemy's target public float moveSpeed = 3; //move speed public float rotationSpeed = 3; //speed of turning public float attackRange = 3; // distance within which to attack public float chaseRange = 10; // distance within which to start chasing public float giveUpRange = 20; // distance beyond which AI gives up public float attackRepeatTime = 1.5f; // delay between attacks when within range public GameObject anim; public float maximumHitPoints = 5.0f; public float hitPoints = 5.0f; public AudioClip attack; private bool chasing = false; private float attackTime; public bool checkRay = false; public string idleAnim = "idle"; public string walkAnim = "walk"; public string attackAnim = "attack"; public int dontComeCloserRange = 4; private Transform myTransform; //current transform data of this enemy void Awake() { myTransform = transform; //cache transform data for easy access/preformance anim.GetComponent<Animation>().wrapMode = WrapMode.Loop; anim.GetComponent<Animation>()[attackAnim].wrapMode = WrapMode.Once; anim.GetComponent<Animation>()[attackAnim].layer = 2; anim.GetComponent<Animation>().Stop(); } void Start() { target = GameObject.FindWithTag("Player").transform; } void Update() { // check distance to target every frame: float distance = (target.position - myTransform.position).magnitude; if (distance < dontComeCloserRange) { moveSpeed = 0; anim.GetComponent<Animation>()[idleAnim].speed = .4f; anim.GetComponent<Animation>().CrossFade(idleAnim); } else { moveSpeed = Random.Range(4, 6); anim.GetComponent<Animation>().CrossFade(walkAnim); } if (chasing) { //move towards the player myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime; //rotate to look at the player myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime); transform.eulerAngles = new Vector3(0, transform.eulerAngles.y, 0); // give up, if too far away from target: if (distance > giveUpRange) { chasing = false; } // attack, if close enough, and if time is OK: if (distance < attackRange && Time.time > attackTime) { anim.GetComponent<Animation>()[attackAnim].speed = 2.0f; anim.GetComponent<Animation>().CrossFade(attackAnim); attackTime = Time.time + attackRepeatTime; GetComponent<AudioSource>().PlayOneShot(attack, 1.0f / GetComponent<AudioSource>().volume); playerCan = target.transform.gameObject.GetComponent<HealthScript>(); playerCan.hitPoints -= damage; } } else { // not currently chasing. anim.GetComponent<Animation>()[idleAnim].speed = .4f; anim.GetComponent<Animation>().CrossFade(idleAnim); // start chasing if target comes close enough if (distance < chaseRange) { chasing = true; } } } void OnDrawGizmosSelected() { Gizmos.color = Color.yellow; Gizmos.DrawWireSphere(transform.position, attackRange); Gizmos.color = Color.red; Gizmos.DrawWireSphere(transform.position, chaseRange); } } Player Health Code; using UnityEngine; using System.Collections; using UnityEngine.UI; public class HealthScript : MonoBehaviour, IDamagable { //FPS KIT [www.armedunity.com] HealthScript PlayerCan; public float hitPoints; public int maxHitPoints; public bool regeneration = false; public float regenerationSpeed; public AudioSource aSource; public AudioClip painSound; public AudioClip fallDamageSound; public Transform deadReplacement; private float t = 0.0f; private float alpha; private bool isDead = false; private ScoreManager scoreManager; public Transform camShake; private Vector3 originalPos; Image damageImage; Image canbar; Text healthText; void Start() { canbar = CanvasManager.instance.canBar; damageImage = CanvasManager.instance.damageImage; scoreManager = ScoreManager.instance; originalPos = camShake.localPosition; if (regeneration) hitPoints = maxHitPoints; alpha = 0.0f; } void Update() { if (t > 0.0f) { t -= Time.deltaTime; alpha = t; if(hitPoints > 0) { Color col = damageImage.color; col.a = alpha; damageImage.color = col; } } if (regeneration) { if (hitPoints < maxHitPoints) hitPoints += Time.deltaTime * regenerationSpeed; } } public void ApplyDamage(int damage) { if (hitPoints < 0.0f) return; hitPoints -= damage; canbar.transform.localScale = new Vector3 (hitPoints/100, 0.35f, 1); if (hitPoints >= 100) { hitPoints = 100; } aSource.PlayOneShot(painSound, 1.0f); t = 2.0f; if (hitPoints <= 0.0f) Die(); } public void ApplyExplosionDamage (int damage) { if (hitPoints < 0.0f) return; StartCoroutine(Shake(damage)); hitPoints -= damage; canbar.transform.localScale = new Vector3 (hitPoints, 0.35f, 1); if (hitPoints >= 0) { hitPoints = 0; } aSource.PlayOneShot(painSound, 1.0f); t = 2.0f; if (hitPoints <= 0.0f) Die(); } public void Medic(int medic) { hitPoints += medic; if (hitPoints > maxHitPoints) { float convertToScore = hitPoints - maxHitPoints; scoreManager.AddScore(System.Convert.ToInt32(convertToScore)); hitPoints = maxHitPoints; } canbar.transform.localScale = new Vector3 (hitPoints / 0, 0.35f, 1); if (hitPoints >= 100) { hitPoints = 100; } } void Die() { if (isDead) return; isDead = true; Color col = damageImage.color; col.a = 1.0f; damageImage.color = col; CanvasManager.instance.HideUI(); Instantiate(deadReplacement, transform.position, transform.rotation); Destroy(gameObject); canbar.transform.localScale = new Vector3 (hitPoints / 0, 0.35f, 1); if (hitPoints >= 0) { hitPoints = 0; } } public void PlayerFallDamage(float dam) { ApplyDamage((int)dam); if (fallDamageSound) aSource.PlayOneShot(fallDamageSound, 1.0f); } IEnumerator Shake(float p) { float t = 1.0f; float shakePower; while (t > 0.0f) { t -= Time.deltaTime; shakePower = t / 50; camShake.localPosition = originalPos + Random.insideUnitSphere * shakePower * 35; yield return 0; } } }
  3. czshow35

    Script help me

    No need anymore. Found in the script section big thanks ArmedUnity current problem player damage
  4. czshow35

    Script help me

    can you arrange for me? I Coulduln't zAI.js
  5. czshow35

    Script help me

    How can I do in c#?
  6. czshow35

    Script help me

    Thanks I edited the script. playerHealth script add > Soldier AI I was able. playerHealth script add > Zombie AI error (PlayerHealth c#)(Zombie AI js)
  7. czshow35

    Script help me

    Hello I'm language little English. I auFPSKit downloaded Zombie model, soldier model and animations added. Enemy health and damage do not add script added help me. (make a video) failed video:
×
×
  • Create New...