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.


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Johannes

  1. Haha its a balcony , thanks man !
  2. I see Distopia has an obviously better script but id like to point out that your script is based on mouse movement and this one is based on weapon movement (therefore player movement or WADS) so id like to post this anyway. I took a few minutes to look at the script and just change it slightly. Now it also makes use of the X axis therefore the gun tilts forward on input(movement). var smooth : float = 2; var tiltAngle : float = 15; function Update () { var Tilt = Input.GetAxis("Horizontal") * tiltAngle; var Tilt2 = Input.GetAxis("Vertical") * tiltAngle; var target : Quaternion = Quaternion.Euler(Tilt2, 0, Tilt); transform.localRotation = Quaternion.Slerp(transform.localRotation, target, Time.deltaTime * smooth); } I don't know if someone will find it use-full. I found the original script quite handy being a novice scriptwriter. After some playing around I noticed that for an optimal thriller/Horror feeling both scripts apllied have a great effect! Give it a try. (Mouse Tilt script and Movement Tilt script)
  3. I think its quite perfect , reminds me of Dead Trigger. I'm using this in my current project.
  4. This script was made by me by extracting,implementing and altering features from various scripts, as well as some of my own code. I do not take credit for all of the code. Flashlight Script var Flashlight : Light; //Connect the light source in the Inspector var LightOn : boolean = true; var LightDrainSpeed : float = 0; var BatteryLife : float = 0.0; var MaxBatteryLife : float = 0; var BatteryTex : Texture2D; //Optional//var FlashlightTrigger : AudioClip; function Update () { if (LightOn && BatteryLife >= 0) { BatteryLife -= LightDrainSpeed * Time.deltaTime; } Flashlight.light.intensity = BatteryLife; if(BatteryLife <= 0) { Batterylife = 0; } if(Input.GetKeyUp(KeyCode.F)) { //Optional//audio.PlayOneShot(FlashlightTrigger); if(LightOn) { LightOn = false; } else if(!LightOn && BatteryLife >= 0) { LightOn = true; } Lighten(); } } function ChargeBattery() { // function called by battery pickup BatteryLife = MaxBatteryLife; // sets full charge } function Lighten() { if(LightOn) { Flashlight.light.active = true; } else { Flashlight.light.active = false; } } function OnGUI() { var charge = 100 * BatteryLife/MaxBatteryLife; GUI.DrawTexture(Rect(10,40,20,20), BatteryTex); // to have it in text:GUI.Label(Rect(80,20,50,20), charge.ToString("F0")+"%"); GUI.HorizontalScrollbar(Rect (40,40,500,20), 0, charge,0, 100); } If you want the charge to be shown in text rather than with a scrollbar remove the (// to have it in text:) line. Battery Pick-up Script var GUIToggle: boolean = false; function OnTriggerStay(other: Collider) { GUIToggle = true; if (other.tag == "Player" && Input.GetKeyDown("e")) { // call the function ChargeBattery in the player or its children: other.BroadcastMessage("ChargeBattery"); Destroy(gameObject); // destroy the pickup } } function OnGUI () { if (GUIToggle == true) { GUI.Label (Rect (10, 70, 300, 40), "Press E to pick up Battery Pack"); } } function OnTriggerExit (Player : Collider) { GUIToggle = false; } I hope someone finds this usefull.
  5. Great stuff will definitely be useful!
  6. Hello everyone , I joined this forum a few weeks ago but ive only now had a chance to really participate. So far browsing the topics and examples ive learned a few things and seen some awesome projects. Some of you are busy with some amazing things. I hope your projects work out well. I have been learning (Teaching myself) Unity and scripting for about 2 years now and ive picked up a few things but love learning more daily. Im currently working on a thriller/horror type game that I plan to release for free. I look forward to sharing with the community whenever I can and thanks for all the work you've shared with me so far.
  7. Great work man! Looks amazing! Seriously impressed, keep it up.
  • Create New...