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.

Leaderboard


Popular Content

Showing content with the highest reputation on 02/08/2015 in all areas

  1. 3 points
    hello I just decided to make a script for my game but I decided to share it here and i am a noob video : https://www.youtube.com/watch?v=ng7wQcbGL0s ///////////////////////Script escrito por Fbiel///////////////// // // // // ///////////////////////////////////////////////////////////// //Anexos//Miras// var Holo : GameObject; var Reflex : GameObject; var Acog : GameObject; //Anexos//Abaixo// var Flash : GameObject; var Laser : GameObject; //Anexos//Cano// var Silenciador : GameObject; //Arma// var Weapon : GameObject; //Gui// var GuisKin : GUISkin; //Sounds// var clickSound : AudioClip; //Misc// var LockObject : GameObject; private var IsCustom : boolean; function Start () { } function Update () { if(Input.GetKeyDown("q")){ if(IsCustom == true){ IsCustom = false; Weapon.SendMessage("ExitCustom", SendMessageOptions.DontRequireReceiver); LockObject.SendMessage("ExitCustom", SendMessageOptions.DontRequireReceiver); Screen.showCursor = false; } else if(IsCustom == false){ Screen.showCursor = true; IsCustom = true; Weapon.SendMessage("EnterCustom", SendMessageOptions.DontRequireReceiver); LockObject.SendMessage("IsCustom", SendMessageOptions.DontRequireReceiver); } } } function OnGUI(){ GUI.skin = GuisKin; if(IsCustom == true){ GUI.Box(Rect (10,10,400,200), "Customizaçao"); if (GUI.Button (Rect (20,70,80,20),"Holografica")){ Holo.gameObject.SetActive(true); Reflex.gameObject.SetActive(false); Acog.gameObject.SetActive(false); Weapon.SendMessage("Holo", SendMessageOptions.DontRequireReceiver); audio.clip = clickSound; audio.Play(); } if (GUI.Button (Rect (110,70,80,20),"Reflex")){ Holo.gameObject.SetActive(false); Reflex.gameObject.SetActive(true); Acog.gameObject.SetActive(false); Weapon.SendMessage("Reflex", SendMessageOptions.DontRequireReceiver); audio.clip = clickSound; audio.Play(); } if (GUI.Button (Rect (200,70,80,20),"Acog")){ Holo.gameObject.SetActive(false); Reflex.gameObject.SetActive(false); Acog.gameObject.SetActive(true); Weapon.SendMessage("Acog", SendMessageOptions.DontRequireReceiver); audio.clip = clickSound; audio.Play(); } if (GUI.Button (Rect (290,70,80,20),"Nada")){ Holo.gameObject.SetActive(false); Reflex.gameObject.SetActive(false); Acog.gameObject.SetActive(false); Weapon.SendMessage("None", SendMessageOptions.DontRequireReceiver); audio.clip = clickSound; audio.Play(); } if (GUI.Button (Rect (20,100,80,20),"Silenciador")){ Silenciador.gameObject.SetActive(true); Weapon.SendMessage("Silenciado", SendMessageOptions.DontRequireReceiver); audio.clip = clickSound; audio.Play(); } if (GUI.Button (Rect (110,100,80,20),"Nada")){ Silenciador.gameObject.SetActive(false); Weapon.SendMessage("NoSilencer", SendMessageOptions.DontRequireReceiver); audio.clip = clickSound; audio.Play(); } if (GUI.Button (Rect (20,130,80,20),"Flash")){ Flash.gameObject.SetActive(true); Laser.gameObject.SetActive(false); audio.clip = clickSound; audio.Play(); } if (GUI.Button(Rect (110,130,80,20),"Laser")){ Flash.gameObject.SetActive(false); Laser.gameObject.SetActive(true); audio.clip = clickSound; audio.Play(); } if (GUI.Button(Rect (290,130,80,20),"Nada")){ Flash.gameObject.SetActive(false); Laser.gameObject.SetActive(false); audio.clip = clickSound; audio.Play(); } } }
  2. 1 point
  3. 1 point
    Hey guys, so I decided to make a thread about the useful scripts that are in this very useful forum. This thread will be updated regularly as soon as I (or you) find some useful scripts. If you found this helpful then leave a "like"! FORMAT: (thread name) by (author of thread) [language (C#/JS)] LIST [@DaBossTMR] Flashlight Script v2.1.1 by DaBossTMR [C#] Bullet Trajectory/Physics by DaBossTMR (credits to Jeremy Clark) [C#] Player Push (less glitchier) by DaBossTMR [C# and JS] [NGUI] Changing Screen Resolutions by DaBossTMR [C#] Top-down Shooter Camera by DaBossTMR [C#] Object Impact Sound by DaBossTMR [C# and JS] Populate Terrain Grass by DaBossTMR [C#] Realistic Camera Shake by DaBossTMR [C#] (credits go to UTnT) Find Closest Transform With Tag by DaBossTMR [C#] Disable ALT-F4 In Game by DaBossTMR [C# and JS] Extended FPS Counter by DaBossTMR [C#] [@OneManArmy] Jeremy Clark's FPS Scripts by OneManArmy [JS] RTS Camera by OneManArmy [JS] Rigidbody Controller by OneManArmy [JS] Buoyancy (Floating Objects) by OneManArmy [C#] Audio Effect When Falling by OneManArmy [JS] Cigarette Smoke Trail by OneManArmy [JS] [@OcularCash] Save/Load Method (Player Prefs) by OcularCash [JS] Health Regeneration by OcularCash [JS] Bouncing Betty/Freddy by OcularCash [JS] COD Style Cooked Grenades by OcularCash [JS] Javelin Script by OcularCash [JS] Stealth Bomber by OcularCash [JS] Harrier with Airstrike by OcularCash [JS] Anti-Spawn Trapping by OcularCash [JS] Predator Missile by OcularCash [JS] Weapon Wheel (GUI) by OcularCash [JS] MW2 Style Semtex Grenade by OcularCash [JS] Team Selection (Private Match) by OcularCash [JS] Flare Gun (with Exploding Rounds) by OcularCash [JS] Explosion (Linear Falloff Damage) by OcularCash [JS] Using Enums To Call Functions by OcularCash [JS] Basic Procedural Player + Movement + Walkable Area by OcularCash [JS] [@Duxducis404] Quake Map Loader (pk3 files) by Duxducis404 [C#] [@YoungDeveloper] Simple Teleport by YoungDeveloper [C#] [@T3kaT0kIkuTa] Particle Magnet by T3kaT0kIkuTa [C#] [@DarkChaos] Wall Avoidance by DarkChaos [JS] Disable Shadows For One Camera by DarkChaos [JS] Improved Sniper Scope System by DarkChaos [JS] Frames Per Second Counter by DarkChaos [JS] Knife Script with Animation Support by DarkChaos [JS] Countdown Timer by DarkChaos [JS] [@themars2011] Extended Timer/Counter by themars2011 [JS] Useful Networking Scripts by themars2011 [JS] Toggle Aim by themars2011 [JS] Mouse Look w/ Custom Editor by themars2011 [JS] [@bxboy15] Weapon Sway/Rotation by bxboy15 [JS] [@ProRussianMn] Save/Load Method (XML) by ProRussianMn [JS] [@jordanblythe104] Weapon Sway Script (Red Orchestra Style) by jordanblythe103 [JS] [@aeditz50] Cinematic Camera Shake by aeditz50 [C#] [@nightbird0] Smart FPS Counter by nightbird0 [C#] [@Epic-Shot] Fullscreen Video Using GUI (Pro Only) by Epic-Shot [C#] [@loftail] Zombie AI (Pro Only) by loftail [JS] [@dreadt9] Sentry Gun by dreadt9 [JS] l4mishotiz (Unity Forums) FPS Starter Scripts by l4mishotiz [uNKNOWN] [@jediaction] Peek Script by jediaction [JS] SIMPLE SCRIPTS/TOOLS Simple Tips System by pspdude [JS] Javascript to C# Converter by M2H [C# people]
  4. 1 point
    I am trying to add bullet penetration and i noticed that Physics.RaycastAll detects only one hit per collider. Video: First model has few separated parts, but second is one single mesh. Both models has mesh collliders. Maybe exist way to detect multiple hits on mesh colllider by using Physics.RaycastAll?
  5. 1 point
    How to make a Laser Beam Effect Hi guys! I decided to contribute a little to this incredible community and release a tutorial. Even if it's simple, it may be useful for some people. Here i'm gonna teach you how to make a Laser beam effect. First of all, this is the final effect we're going to achieve: Let's start: 1 - Create an empty gameObject and make it a child of your gun object in the hierarchy. Name it whatever you want. (Something like, "laser"). 2 - With the "laser" GameObject selected, go to: Component > Effects > Line Renderer. 3 - Get a Perlin Noise texture like this one: 4 - Create a new material with a Self-Ilumination/Diffuse Shader and assign the noise texture as the base texture of the material and the illumination too. 5 - Change the material color to green (or red if you like). 6 - Assign this material to the line renderer and adjust the settings (I recommend putting the start width to something very low, in this example, i'm using "0.0005"). This part creates the laser beam itself. Now let's do the light emmited where the laser hits. You'll need to use this script: (LaserBeam.js) #pragma strict var LaserOrigin: Transform; // Put the laser (line renderer) object here. var LaserTarget: Transform; //The point light object. function Update () { var ray = new Ray(LaserOrigin.transform.position, LaserOrigin.transform.forward); //Casts a new ray var hit: RaycastHit; if(Physics.Raycast(ray, hit, Mathf.Infinity)) { LaserTarget.transform.position = hit.point; //Positions the light at the same point the laser hits something. } } 7 - Assign the variables (they're explained as comments in the script) 8 - For the point light, simply create a point light, and assign it a small range, but a high intensity. (In the example: 0.31 - Range; and 1.57 - Intensity) Now the point light will illuminate the place the laser hits. Be aware that this will increase the draw call count (here it increased 3 draw calls). The performance hit is unnoticeable for me, as I'm using Deferred Rendering, and light costs the amount of pixels illuminated. If you're using Forward Rendering, it costs the amount of objects illuminated. ------------------------------------------------- Tell me what do you guys think and if you have another method let us know! I Hope it helps someone!
  6. 1 point
    $5 Dollar the template. Contact me
  7. 1 point
    This is a little tip in order to create a double strip in the screen to create something similar with a cinematic effect. You can create a double horizontal stripe (up and down), a double vertical stripe (left and right) or the both as a scarf. This script is based on the first work from WillyWill which is available here on this forum. I know that we can do that using another method via GUI by I prefer this simple alternative. I have created a folder which is named MyShaders in order to keep my project clean. Change it if you want. This script can be easily improved with another features. Also I hope you like it ++ Shader script Shader "MyShaders/Cinematic" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _Top ("Top Bar", Range(0.0,0.5)) = 0.0 _Bottom ("Bottom Bar", Range(0.0,0.5)) = 0.0 _Right ("Right bar", Range(0.0,0.5)) = 0.0 _Left ("Left bar", Range(0.0,0.5)) = 0.0 _R ("_R", Range(0.0, 1.0)) = 0.0 _G ("_G", Range(0.0, 1.0)) = 0.0 _B ("_B", Range(0.0, 1.0)) = 0.0 } SubShader { Pass { ZTest Always Cull Off ZWrite Off Fog { Mode off } CGPROGRAM #pragma vertex vert_img #pragma fragment frag #pragma target 3.0 #include "UnityCG.cginc" #pragma multi_compile Cinematic Corridor Scarf uniform sampler2D _MainTex; uniform float _Top; uniform float _Bottom; uniform float _Right; uniform float _Left; uniform float _R; uniform float _G; uniform float _B; struct appdata_t { float4 vertex : POSITION; float4 color : COLOR; float2 texcoord : TEXCOORD0; }; struct v2f { half2 texcoord : TEXCOORD0; float4 vertex : SV_POSITION; fixed4 color : COLOR; }; v2f vert(appdata_t IN) { v2f OUT; OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex); OUT.texcoord = IN.texcoord; OUT.color = IN.color; return OUT; } float4 frag(v2f_img i) : COLOR { #ifdef Cinematic float4 _Screen = tex2D(_MainTex, i.uv); float4 _Border; _Border.y = i.uv.y; _Screen.xyz = (_Border.y > _Bottom && _Border.y < _Top) ? _Screen.xyz : float3(_R, _G, _; return _Screen; #endif #ifdef Corridor float4 _Screen = tex2D(_MainTex, i.uv); float4 _Border; _Border.x = i.uv.x; _Screen.xyz = (_Border.x > _Left && _Border.x < _Right) ? _Screen.xyz : float3(_R, _G, _; return _Screen; #endif #ifdef Scarf float4 _Screen = tex2D(_MainTex, i.uv); float4 _Border; _Border.y = i.uv.y; _Screen.xyz = (_Border.y > _Bottom && _Border.y < _Top) ? _Screen.xyz : float3(_R, _G, _; _Border.x = i.uv.x; _Screen.xyz = (_Border.x > _Left && _Border.x < _Right) ? _Screen.xyz : float3(_R, _G, _; return _Screen; #endif } ENDCG } } } C# script using UnityEngine; using System.Collections; [ExecuteInEditMode] [AddComponentMenu ("MyShaders/Cinematic")] public class Cinematic : MonoBehaviour { #region Variables public Shader _Shader; public enum _StyleX { Cinematic = 0, Corridor = 1, Scarf = 2 } public _StyleX _Style; [Range(0.0f, 0.5f)] public float _Width = 0.10f; [Range(0.0f, 1.0f)] public float _R = 0.0f; [Range(0.0f, 1.0f)] public float _G = 0.0f; [Range(0.0f, 1.0f)] public float _B = 0.0f; private Material _Material; #endregion #region Properties Material material { get { if(_Material == null) { _Material = new Material(_Shader); _Material.hideFlags = HideFlags.HideAndDontSave; } return _Material; } } #endregion void Start () { _Shader = Shader.Find("MyShaders/Cinematic"); if(!SystemInfo.supportsImageEffects) { enabled = false; return; } } void OnRenderImage (RenderTexture sourceTexture, RenderTexture destTexture) { if(_Shader != null) { _Width = Mathf.Clamp01(_Width); material.SetVector("_ScreenResolution", new Vector2(Screen.width,Screen.height)); material.SetFloat("_R", _R); material.SetFloat("_G", _G); material.SetFloat("_B", _; if(_StyleX.Cinematic == _Style) { material.SetFloat("_Top", 1 - _Width); material.SetFloat("_Bottom", _Width); } if(_StyleX.Corridor == _Style) { material.SetFloat("_Right", 1 - _Width); material.SetFloat("_Left", _Width); } else if(_StyleX.Scarf == _Style) { material.SetFloat("_Top", 1 - _Width); material.SetFloat("_Bottom", _Width); material.SetFloat("_Right", 1 - _Width); material.SetFloat("_Left", _Width); } Graphics.Blit(sourceTexture, destTexture, material); } else { Graphics.Blit(sourceTexture, destTexture); } } void Update () { #if UNITY_EDITOR if (Application.isPlaying!=true) { _Shader = Shader.Find("MyShaders/Cinematic"); } #endif if(_StyleX.Cinematic == _Style) { Shader.EnableKeyword("Cinematic"); Shader.DisableKeyword("Corridor"); Shader.DisableKeyword("Scarf"); } if(_StyleX.Corridor == _Style) { Shader.EnableKeyword("Corridor"); Shader.DisableKeyword("Cinematic"); Shader.DisableKeyword("Scarf"); } else if(_StyleX.Scarf == _Style) { Shader.EnableKeyword("Scarf"); Shader.DisableKeyword("Cinematic"); Shader.DisableKeyword("Corridor"); } } void OnDisable () { if(_Material) { DestroyImmediate(_Material); } } }
  8. 1 point
    I don't think you fully understand the function. Your PUN version should always be the latest, but in the function it's asking for your game version, this is obviously used to prevent games with different versions connecting with each other, so that nothing weird happens. So input as a string whatever you want : "1.0"
  9. 1 point
    Hey OMA, so I see you have a RaycastAll mesh collider problem. Luckily for you this problem has already been solved quite a while ago by creating multiple raycasts (a bit inefficient but powerful) to calculate the collision points on a Mesh Collider. Here is an example found on the Unity Forums: public static RaycastHit[] RaycastAllNonConvex( Vector3 origin, Vector3 destination) { List<RaycastHit> hits = new List<RaycastHit>(); Vector3 delta = destination - origin; Vector3 dir = delta.normalized; while (true) { RaycastHit hit; float dist = delta.magnitude; //get raycast distance if ( Physics.Raycast( origin, dir, out hit, dist) ) { origin = hit.point + dir * 0.01f; //rem that collision is inclusive hits.Add( hit ); //Add this point to the list } else { break; //Done for good, break out of loop } } return hits.ToArray(); }
  10. 1 point
    My show that I mentioned before, close captioning, was my little project that I've been making as of late (which is why I took a short break from game making). My uncle, JR. DeLang, who was the former VP at fox studios (look it up) said that he may, if it's good enough, be able to get it on TV. Now in order to do this, I'd need donations. Now, if you do donate, A) I'll put you in the credits of an episode as an executive producer. B ) I'll try and work you into an episode. And C) I'll do something, on your request for you. So can you help a guy out? Message me if you wanna donate to the show.
  11. 1 point
    anything to show us? Because if you do you need to make a post like:http://armedunity.com/topic/3678-before-you-create-a-post-read-this/
  12. 1 point
    I thought I would have time but I was wrong. I got about an hour in and ran out of time. I'll post what I have so far though. It's kind of sloppy tho because I was trying to get it done as fast as I could before running out of time. It's not even close to being finished but the basic concept is there Database.js class Piece { var Name : String; var Image : Sprite; } enum Status {Open, Friendly, Unfriendly} class Node { var ID : int; var status : Status; var obj : GameObject; function Node() { ID = 1000; status = 0; } } public var pieces : Piece[]; Game.js public var board : Node[,]; private var myParent : GameObject; private var enemyParent : GameObject; private var turn : Turn; var selectedPosition : Vector2; private var availableMoves = new ArrayList(); function Awake() { SetupBoard(); } function Update() { if(Input.GetMouseButtonDown(0) && turn == 0) { var hit : RaycastHit; var ray : Ray = camera.main.ScreenPointToRay(Input.mousePosition); if(Physics.Raycast(ray, hit, 10)) { if(hit.transform.tag == "Player") { availableMoves.Clear(); GetMovePositions(hit.transform.gameObject); MovePiece(availableMoves[Random.Range(0, availableMoves.Count - 1)]); } } } } function SetupBoard() { board = new Node[8, 8]; var a : int; var b : int; myParent = new GameObject(); myParent.name = "My_Pieces"; enemyParent = new GameObject(); enemyParent.name = "Enemy_Pieces"; for(a = 0; a < 8; a++) { for(b = 0; b < 8; b++) { board[b, a] = new Node(); if(a == 1) { CreatePiece(0, 1, Vector2(b, a)); } if(a == 6) { CreatePiece(0, 2, Vector2(b, a)); } } } } function CreatePiece(ID : int, status : int, Pos : Vector2) { var piece = new GameObject(); board[Pos.x, Pos.y].ID = ID; board[Pos.x, Pos.y].status = status; board[Pos.x, Pos.y].obj = piece; piece.name = database.pieces[ID].Name; piece.transform.position = Vector3(Pos.x, Pos.y, 0); piece.AddComponent.<BoxCollider>(); piece.AddComponent.<SpriteRenderer>(); piece.GetComponent.<SpriteRenderer>().sprite = database.pieces[ID].Image; if(status == 1) { piece.tag = "Player"; piece.transform.parent = myParent.transform; } if(status == 2) { piece.transform.parent = enemyParent.transform; } } function MovePiece(To : Vector2) { var copied = board[selectedPosition.x, selectedPosition.y]; board[selectedPosition.x, selectedPosition.y] = new Node(); if(board[To.x, To.y].obj) Destroy(board[To.x, To.y].obj); board[To.x, To.y] = copied; board[To.x, To.y].obj.transform.position = Vector3(To.x, To.y, 0); } function GetMovePositions(obj : GameObject) { selectedPosition = Vector2(obj.transform.position.x, obj.transform.position.y); GetHorizontalAndVerticalMoves(); } function GetDiagnoalMoves() { } function GetHorizontalAndVerticalMoves() { var a : int; if(selectedPosition.x < 7) { for(a = selectedPosition.x + 1; a < 8 - selectedPosition.x; a++) { if(board[a, selectedPosition.y].ID == 1000) { availableMoves.Add(Vector2(a, selectedPosition.y)); continue; } if(board[a, selectedPosition.y].ID != 1000 && board[a, selectedPosition.y].status == 2) { availableMoves.Add(Vector2(a, selectedPosition.y)); break; } } } if(selectedPosition.x > 0) { for(a = selectedPosition.x - 1; a < selectedPosition.x; a++) { if(board[a, selectedPosition.y].ID == 1000) { availableMoves.Add(Vector2(a, selectedPosition.y)); continue; } if(board[a, selectedPosition.y].ID != 1000 && board[a, selectedPosition.y].status == 2) { availableMoves.Add(Vector2(a, selectedPosition.y)); break; } } } if(selectedPosition.y < 7) { for(a = selectedPosition.y + 1; a < 8 - selectedPosition.y; a++) { if(board[selectedPosition.x, a].ID == 1000) { availableMoves.Add(Vector2(selectedPosition.x, a)); continue; } if(board[selectedPosition.x, a].ID != 1000 && board[selectedPosition.x, a].status == 2) { availableMoves.Add(Vector2(selectedPosition.x, a)); break; } } } if(selectedPosition.x > 0) { for(a = selectedPosition.y - 1; a < selectedPosition.y; a++) { if(board[selectedPosition.x, a].ID == 1000) { availableMoves.Add(Vector2(selectedPosition.x, a)); continue; } if(board[selectedPosition.x, a].ID != 1000 && board[selectedPosition.x, a].status == 2) { availableMoves.Add(Vector2(selectedPosition.x, a)); break; } } } } function GetSingleMoves() { }
  13. 1 point
    Boo: JavaScript : Previews:
  14. 1 point
    I heard, learning and doing it yourself was free. Just a rumor though.
  15. 1 point
    the blood actually looks really cool but in game i would like it to have the blood not in the center of the screen only at the borders , to see i got hit but i still can see ... still nice work ive created an example:
  16. 1 point
    Translate 1940-Berlin The Germans had no doubt win the war still will con-, but there were some bitter Käempfer among them who wanted at all costs Eringen a victory. These radical Nazis, often described as weak-willed, silly and stupid, were, at least some of them, Unfortunately, not so stupid and spineless. So a group of Nazi doctors came the idea of a "Plan B" to tinker They knew that a mathematician named Kurt Gödel already had a formula aufgestelt, are possible bewieß that time travel. They even had access to that formula, since the Gödel had left her house only days ago and it was already vacated by SS men, and they came across this formula, which was not understood by most Nazis, of a However, already and as luck would have it is also found that in the group described a rocket scientist worked with Wernher von Braun and a chemist of a revolutionary fuel / secondary explosive was convinced, where he conducted research. He said that even this fuel with a mass of only 1kg release enough energy könte around the world including atmosphere to heat 2 °. That would be enough to let fly at only 5kg to a Rakte 10years long in the speed of light, the acceleration time of 3years is already included. After much superior to our three scientists were convinced that time travel is possible and that they are such also perform in the position. Plan B looked after some time the debate and brooding now as follows: -a build the rocket is driven by the "super fuel" to travel into the future -In The future, information on the outcome of the war and collect high-tech weapons leave â formula of kurt Goebels, so scientists at the negative acceleration can research so they from the future back into the past (the war began) could travel â Acquired apply knowledge in the past and win the war. However, when the rocket was ready and they already 5years long is auserhalb the Earth's atmosphere were undoubtedly came on, it would work. A year späeter they made sail back to the earth, for it is already wren on the edge our galaxy reached. further six years späeter they arrived back on Earth. When entering the earth's atmosphere verglüehte the greatest part of its missile and it Could be just so in a parachute rescue capsule. They were now arrived back on Earth after 123 years, but what they saw enjoyed any of them.
×
×
  • Create New...