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.

geckoo

Moderators
  • Content Count

    2,815
  • Joined

  • Last visited

  • Days Won

    155

Everything posted by geckoo

  1. Again a silly question. In a script JS, how i can call a function who is in an another script? I read this information in a tutorial but i forgot. Thanks you for support ++
  2. Full code if you wanna read it and comment it (SentryGun.js by OMA in fps_tutorial - original code by Joachim Ante). Replace the original code, find a sound and try it ++ @script RequireComponent(AudioSource) var attackRange = 33.0; var shootAngleDistance = 15.0; var target : Transform; var detected : AudioClip; var audioAlarmLength = 2; var countdown = 1; // 2 or 3 for an echo effect with the alert sound // who is my target? - i am function Start () { if (target == null && GameObject.FindWithTag("Player")) target = GameObject.FindWithTag("Player").transform; } function Update () { if (target == null) return; if (!CanSeeTarget ()) return; // Oups! Turret see us // Rotate towards target var targetPoint = target.position; var targetRotation = Quaternion.LookRotation (targetPoint - transform.position, Vector3.up); transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2.0); alertOn(); // alternative 1 (my choice) // If we are almost rotated towards target - fire one clip of ammo var forward = transform.TransformDirection(Vector3.forward); var targetDir = target.position - transform.position; // Angle OK - shoot him! if (Vector3.Angle(forward, targetDir) < shootAngleDistance) { SendMessage("Fire"); // alertOn(); // alternative 2 } } // alt 1 - this function emits a sound when the turret see the player (or) // alt 2 - this function emits a sound when the turret send a "fire" message (or) // alt 3 - this function emits a sound when the turret can see the player (make the difference with first alternative) function alertOn () { if (countdown == 0) return; else AudioSource.PlayClipAtPoint(detected, transform.position); countdown --; // to avoid too many sound in process (update function causes this annoying effect) yield WaitForSeconds(audioAlarmLength); countdown ++; // again } function CanSeeTarget () : boolean { // Player is too far of her enemy (no danger) if (Vector3.Distance(transform.position, target.position) > attackRange) return false; // In an other case, turret shot him because player is too near of our turret var hit : RaycastHit; // alertOn(); // alternative 3 // if you prefer, you can call function alertOn when the turret can see the player. if (Physics.Linecast (transform.position, target.position, hit)) return hit.transform == target; return false; }
  3. Finally i found this way, but i don't know if it's really professional In the meantime, it works pretty well ++ var countdown = 1; // or 2/3 for an echo effect function alertOn () { if (countdown == 0) return; else AudioSource.PlayClipAtPoint(detected, transform.position); countdown --; yield WaitForSeconds(audioAlarmLength); countdown ++; }
  4. Hello. I have a problem of understanding, which I would submit to you. I want to add a sound on this script to trigger an alert. I created a function for sound and it works ... but as an annoying loop because I'm in the Update function. Inevitably I end up with a lot of appeal to this function. So chaos. I am looking for a way to create a condition on this function so that it is played once. What do you think? THX friends ++ Tutorial_fps (by OMA) function Update () { if (target == null) return; if (!CanSeeTarget ()) return; // Oups! Turret see us // Rotate towards target var targetPoint = target.position; var targetRotation = Quaternion.LookRotation (targetPoint - transform.position, Vector3.up); transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2.0); // If we are almost rotated towards target - fire one clip of ammo var forward = transform.TransformDirection(Vector3.forward); var targetDir = target.position - transform.position; // Angle OK - shoot him! if (Vector3.Angle(forward, targetDir) < shootAngleDistance) { SendMessage("Fire"); alertOn(); } } function alertOn () { AudioSource.PlayClipAtPoint(detected, transform.position); return; }
  5. geckoo

    Orb - FinalPK0.85

    Ok I understand. Thanks for this idea ++
  6. geckoo

    Orb - FinalPK0.85

    Orb would look much better if I replace it with this drone? Ok. I try... But it will be more efficient? It's an other script? It's the same IA?
  7. geckoo

    Orb - FinalPK0.85

    It's alright. I found my mistake and I fixed it. It's a silly taping error when i wrote the name of the empty object - TargetPoint (мне позор). Sorry for the inconvenience. I lost many precious time for this stupidity. Как говорят, у всех так бывает... This script is really cool with a funny movement and effect when Orb chasing. It's most than a simply turret and It conserves again an IA interesting - rudimentary, but efficient. Thx ++
  8. geckoo

    Orb - FinalPK0.85

    Hi all. I try to use in an empty project the amazing Orb (FinalPK0.85). I don't understand how i can attribute the target. In original project, it's really clear, but i can't reproduce this process with a simply "First Person Controller". Must I specify the camera's position or an other parameter? Thanks ++
  9. It's a (bad) habit to end my tickets like this. It's possible to translate it by "see you later alligator" Oups i forgot ++
  10. Very impressive. It's a good work ++
  11. geckoo

    7dFPS 2013

    You can find on this page the result of last 7dFPS. A lot of this games are developed on Unity, and some are strange. There are good ideas ++ Вы можете в этой странице обнаружить много игр, которые были созданы посредством Unity. Результат интересен. Попробуйте братья ++ http://7dfps.com/?action=games&sort=most_likes
  12. Exactly. We often make this mistake when we start in programming, forgetting gap/ratio with the resolution of screen. The difference is important. Thank you for free distribution. This code is really usefull ++
  13. Hi all! I don't understand how i can redefine a new grid to use the A* Path Finding. In the map Arena (FPS Kit premium 0.85) i create a simple bridge (not an obstacle), but spiders don't change the way. I thought that A* recalculate all the zone to find the better way. Maybe you can explain to me. Thanks you ++ Чёрт! Я сталкиваюсь с трудностями, чтоб понять принципу, но продалжаю искать решение. Помогите пожалуйста. Спасибо ++
  14. geckoo

    система

    Так и есть. Само собой разумеется браток
  15. I think you wanna say 6x2Go DDR2. It's more logical It's not CPU - just memory ++ Никогда ничего подобного я не видел, даже в Албании Мне кажется, что на самом деле это старое DualCore ++ Oupss! Sorry - it's a motherboard and AMD - почему бы нет?
  16. I saw many details very interesting and an original conception. Thanks a lot for free distribution ++ Окружение более менее красиво, а является приятной зоной, чтоб играть онлайн - CS legacy Поздравляю тебя! Спасибо за подарок ++
  17. Mолодой крокодил хочет завести себе друзей

    1. geckoo

      geckoo

      Правда? Откуда ты пришел?

  18. Cool ! et raisonnable. Par contre, je ne vois aucun lien quant au virement. C'est PayPal ? Merci pour ton explication. Tu es de Belgique plus exactement. Je suis sur la frontière Luxembourgeoise ++
  19. Formidable! Je me demandais si la communauté francophone s'intéressait au projet, car jamais personne ne m'en avait parlé. J'en profite pour te poser une question, laquelle pourrait paraître vulgaire en anglais ou en russe. Le projet CoD Kit, est-il réservé à l'équipe qui bosse dessus ou faut-il consentir à quelque compensation financière - le cas échéant, tout à fait normale. Merci pour ton aide ++
  20. Guys you are incredible. I discovered and I understood more things/lessons in your scripts than three years all alone. The FPS Kit is a gift of the Lord. Thank you very much. Sorry but my english is very annoying. I work on it Je suis français, mais personne ici ne semble parler français. Je suis peut-être le premier. Я предпочитаю говорить по-русски. Когда я обнаружил случайно ваш форум, я сразу скачал файл FPS Kit и я прочитал (на самом деле я исследовал) так много интересных кодов и их комментарии, что сейчас хочу с уважением проявить к вам свою благодарность. Вы - мастера. Огромное спасибо вам братья и вам счастливо ++
×
×
  • Create New...