إعـــــــلان
تقليص
لا يوجد إعلان حتى الآن.
اسكربت الاعداء في اليونيتي
تقليص
X
-
الثورة الاسلامية الكبرى لاعادة الخلافة الراشدة
بسم الله الرحمان الرحيم... انما النصر صبر ساعة فلا هوان ولا ستكان حت يعود الضلم تحت الاقدام ويعاقب الخونة وانجاس وترفع الرايات سود و لترتاع يهود لقرب الوعود فالتكن هته الثورة يا اهل مصر و سورية ويا اخواني في العالم اجمع ثورة غضب ثورة غضب خالصة لوجه الله فالتكن بداية النهاية ليعلم اليهود ان الامة اصبحت على فجر النصر وليكن اول بشارات النصر الانتقام من الخونة هم من بني جلدتنا وما هم منا...
امة واحدة راية واحد حرب واحدة
-
في الفور سأبحث و اجيبكAlgeria
-------------
C++ & DirectX
fOr EvEr
-------
add me : prmohamed@hotmail.com
or : kauchmar051@hotmail.com
تعليق
-
اخ احمد والله موقع لتحفة
اك اضن ان هد سكريبت بصيط ومفهوم
http://answers.unity3d.com/questions...e-ai-scripting
ويمكن تعدل على Destroy(player.gameObject) وتغيرها الى تناقص متغير صحة للعب بتانية وتضيف خط فيه ان عدو ينفد حركة هجوم
if (range <= dieRange)
{
Destroy(player.gameObject);
}
else if (range <= chaseRange)
{
transform.LookAt(player);
var moveDirection : Vector3 = transform.TransformDirection(Vector3.forward);
controller.Move(moveDirection * Time.deltaTime * speed);
}
كنت درست في احد دروس كيفية جعل ان لو كان بين عدو والعب حائط او شي يقطع نضر بينهم فهو يعن العب ل يراه حت ولو كانة مسافة قريبة
لكن لنشغالي ببعض امور وعد استمال للكود كتيرا نسيت عليه بتوفيق
ان الاعداء يطاردون اللاعب و يضربونهالتعديل الأخير تم بواسطة naoufal; 15 / 02 / 2011, 03:51 PM.الثورة الاسلامية الكبرى لاعادة الخلافة الراشدة
بسم الله الرحمان الرحيم... انما النصر صبر ساعة فلا هوان ولا ستكان حت يعود الضلم تحت الاقدام ويعاقب الخونة وانجاس وترفع الرايات سود و لترتاع يهود لقرب الوعود فالتكن هته الثورة يا اهل مصر و سورية ويا اخواني في العالم اجمع ثورة غضب ثورة غضب خالصة لوجه الله فالتكن بداية النهاية ليعلم اليهود ان الامة اصبحت على فجر النصر وليكن اول بشارات النصر الانتقام من الخونة هم من بني جلدتنا وما هم منا...
امة واحدة راية واحد حرب واحدة
تعليق
-
مشكوور اخ Pr MoHaMeD اضن ان ساستفيد من في حلة انشغال حالي وسادرس بعض سكربتات الموجودة فيدك موقع بدل راية دروس التي تحتاج وقت بتوفيقالثورة الاسلامية الكبرى لاعادة الخلافة الراشدة
بسم الله الرحمان الرحيم... انما النصر صبر ساعة فلا هوان ولا ستكان حت يعود الضلم تحت الاقدام ويعاقب الخونة وانجاس وترفع الرايات سود و لترتاع يهود لقرب الوعود فالتكن هته الثورة يا اهل مصر و سورية ويا اخواني في العالم اجمع ثورة غضب ثورة غضب خالصة لوجه الله فالتكن بداية النهاية ليعلم اليهود ان الامة اصبحت على فجر النصر وليكن اول بشارات النصر الانتقام من الخونة هم من بني جلدتنا وما هم منا...
امة واحدة راية واحد حرب واحدة
تعليق
-
اولا AI CSharp
كود:using UnityEngine; using System.Collections; public class Enemy_AI : MonoBehaviour { public Transform target; public int moveSpeed; public int rotationSpeed; public int maxDistance; private Transform myTransform ; void Awake(){ myTransform = transform; } // Use this for initialization void Start () { GameObject go = GameObject.FindGameObjectWithTag("Player"); target = go.transform; maxDistance = 2; } // Update is called once per frame void Update () { if(Vector3.Distance(target.position, myTransform.position)<30){ Debug.DrawLine(target.position, myTransform.position, Color.yellow); // Look at target myTransform.rotation = Quaternion.Slerp(myTransform.rotation , Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime); if(Vector3.Distance(target.position, myTransform.position) > maxDistance){ // Move towards myTransform.position +=myTransform.forward*moveSpeed*Time.deltaTime; } } } }
كود:using UnityEngine; using System.Collections; public class EnemyAttack : MonoBehaviour { public GameObject target; public float attackTimer; public float coolDown; // Use this for initialization void Start () { attackTimer = 0; coolDown = 2.0f; } // Update is called once per frame void Update () { if(attackTimer > 0){ attackTimer -= Time.deltaTime; } if(attackTimer < 0){ attackTimer = 0; } if(attackTimer == 0){ Attack(); attackTimer = coolDown; } } private void Attack(){ float distance = Vector3.Distance(target.transform.position, transform.position); Vector3 dir = (target.transform.position - transform.position).normalized; float direction = Vector3.Dot(dir, transform.forward); Debug.Log(direction); if(distance < 2.5f){ if(direction > 0){ PlayerHealth eh = (PlayerHealth)target.GetComponent("PlayerHealth"); eh.AddjustCurrHealth(-10); } } } }
سبحان الله العظيم...سبحان الله وبحمده
لعبتي على (Android & iOS)"همة"
تعليق
-
لكن لازم تحط سكريبت للهيلث
كود:using UnityEngine; using System.Collections; public class PlayerHealth : MonoBehaviour { public int currHealth = 100; public int maxHealth = 100; public float HealthBarLength; // Use this for initialization void Start () { HealthBarLength = Screen.width / 2; } // Update is called once per frame void Update () { AddjustCurrHealth (0); } void OnGUI(){ GUI.Box(new Rect(10, 10, HealthBarLength, 20 ), currHealth + "/" + maxHealth); } public void AddjustCurrHealth(int adj){ currHealth += adj; if(currHealth < 0){ currHealth = 0; } if(currHealth>maxHealth){ currHealth = maxHealth; } if(maxHealth < 1){ maxHealth = 1; } HealthBarLength = (Screen.width / 2) * (currHealth / (float)maxHealth); } }
سبحان الله العظيم...سبحان الله وبحمده
لعبتي على (Android & iOS)"همة"
تعليق
-
المشاركة الأصلية بواسطة cow boy مشاهدة المشاركةاولا AI CSharp
كود:using UnityEngine; using System.Collections; public class Enemy_AI : MonoBehaviour { public Transform target; public int moveSpeed; public int rotationSpeed; public int maxDistance; private Transform myTransform ; void Awake(){ myTransform = transform; } // Use this for initialization void Start () { GameObject go = GameObject.FindGameObjectWithTag("Player"); target = go.transform; maxDistance = 2; } // Update is called once per frame void Update () { if(Vector3.Distance(target.position, myTransform.position)<30){ Debug.DrawLine(target.position, myTransform.position, Color.yellow); // Look at target myTransform.rotation = Quaternion.Slerp(myTransform.rotation , Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime); if(Vector3.Distance(target.position, myTransform.position) > maxDistance){ // Move towards myTransform.position +=myTransform.forward*moveSpeed*Time.deltaTime; } } } }
كود:using UnityEngine; using System.Collections; public class EnemyAttack : MonoBehaviour { public GameObject target; public float attackTimer; public float coolDown; // Use this for initialization void Start () { attackTimer = 0; coolDown = 2.0f; } // Update is called once per frame void Update () { if(attackTimer > 0){ attackTimer -= Time.deltaTime; } if(attackTimer < 0){ attackTimer = 0; } if(attackTimer == 0){ Attack(); attackTimer = coolDown; } } private void Attack(){ float distance = Vector3.Distance(target.transform.position, transform.position); Vector3 dir = (target.transform.position - transform.position).normalized; float direction = Vector3.Dot(dir, transform.forward); Debug.Log(direction); if(distance < 2.5f){ if(direction > 0){ PlayerHealth eh = (PlayerHealth)target.GetComponent("PlayerHealth"); eh.AddjustCurrHealth(-10); } } } }
دروسي :
درسي الاول : تصميم فيلا
درسي التاني : الجزء الاول : تحريك شخصية
درسي التاني : الجزء التاني : تحريك الخصر
درسي الجديد : تصميم Disquette
درس تصميم شخصية كرتونية
شعاري : الاستفادة
ادخل الرابط تحت ضروري :
http://www.shbab1.com/2minutes.htm
تعليق
-
العفو,لكن للاسف ما اعرف ai للجافاسبحان الله العظيم...سبحان الله وبحمده
لعبتي على (Android & iOS)"همة"
تعليق
تعليق