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.

Search the Community

Showing results for tags 'csharp'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


    • Introduce yourself
    • Discussions
    • Showcase
    • Need help?
    • Seeking team members?
    • Offtopic
    • Example Projects
    • Scripts
    • Shaders
    • Unity Tutorials
    • FPS Kit Tutorials
    • 3D models
    • Animated 3D Models
    • Graphic design
    • Textures
    • Sounds
    • Other
    • Sell
    • Request
  • Mars' Modular Multiplayer Photon FPS Kit's Topics
  • Mars' Modular Multiplayer Photon FPS Kit's Reviews
  • Mars' Modular Multiplayer Photon FPS Kit's Updates
  • Mars' Modular Multiplayer Photon FPS Kit's Tutorials
  • Busy People's Introductions
  • Photon's Tutorials
  • Photon's Photon General
  • Photon's Showcase


  • Free Projects
  • Free Assets
  • Game Demos
  • Photon's Files

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL





YouTube URL

Facebook URL

Twitter URL

IndieGoGo URL

Kickstarter URL


GreenLight URL



Found 14 results

  1. Hi there, this is a fire light behaviour script I just made and I just wanted to share it It is not advanced, it is just lerping the position and the light's intensity to somewhat simulate a fire's light. Anyways, just attach the script to the fire's light, tweak the values and you're good to go Copy the below, then create a new C# script, and then paste the code in it(or write it all if ya want ). /* * Author: DeepWolf * Description: Simulates a light's behaviour of a fire. * * Usage: * Attach this script to the light source of the fire and tweak the values. */ namespace DeepWolf.Utilities { using UnityEngine; /// <summary> /// Represents a <see cref="FireLight"/>. /// Handles the breathing and the movement of the fire. /// </summary> [RequireComponent(typeof(Light))] public class FireLight : MonoBehaviour { /// <summary> /// How frequently the <see cref="FireLight"/> will find a new position. /// </summary> [Header("[Movement]")] [SerializeField, Tooltip("How frequenly the light will find a new position.")] private float moveFrequency = 0.15f; /// <summary> /// The lerp speed of the fire movement. The lower the speed, the smoother the movement will be. /// </summary> [SerializeField, Tooltip("The lerp speed of the fire movement. The lower the speed, the smoother the movement will be.")] private float moveLerpSpeed = 1.0f; /// <summary> /// The min and max value of how much the <see cref="FireLight"/>'s <see cref="Transform"/> is able to move in the x axis. /// </summary> [SerializeField, Tooltip("The min and max value of how much the light is able to move in the x axis.")] private Vector2 xMoveLimit = new Vector2(-0.2f, 0.2f); /// <summary> /// The min and max value of how much the <see cref="FireLight"/>'s <see cref="Transform"/> is able to move in the y axis. /// </summary> [SerializeField, Tooltip("The min and max value of how much the light is able to move in the y axis.")] private Vector2 yMoveLimit = new Vector2(-0.0f, 0.15f); /// <summary> /// The min and max value of how much the <see cref="Light"/>'s <see cref="Transform"/> is able to move in the z axis. /// </summary> [SerializeField, Tooltip("The min and max value of how much the light is able to move in the z axis.")] private Vector2 zMoveLimit = new Vector2(-0.2f, 0.2f); /// <summary> /// The breathing frequency of the <see cref="Light.intensity"/>. /// </summary> [Header("[Intensity Breathing]")] [SerializeField, Tooltip("The breathing frequency of the light's intensity.")] private float IntensityBreathFrequency = 0.5f; /// <summary> /// The speed of the intensity transition. /// </summary> [SerializeField, Tooltip("The speed of the intensity transition.")] private float intensityLerpSpeed = 2.0f; /// <summary> /// The minimum the <see cref="Light.intensity"/> value can be. /// </summary> [SerializeField, Tooltip("The minimum the light's intensity value can be.")] private float minIntensity = 0.5f; /// <summary> /// The maximum the <see cref="Light.intensity"/> value can be. /// </summary> [SerializeField, Tooltip("The maximum the light's intensity value can be.")] private float maxIntensity = 1.0f; /// <summary> /// The <see cref="Time.time"/> till the next move transition. /// </summary> private float nextMove; /// <summary> /// The <see cref="Time.time"/> till the next intensity transition. /// </summary> private float nextIntensity; /// <summary> /// The <see cref="Light.intensity"/> value to transition to. /// </summary> private float targetIntensity; /// <summary> /// The <see cref="Light.intensity"/> value to transition to. /// </summary> private Vector3 targetPosition; /// <summary> /// The original <see cref="FireLight"/> position. Used to offset the move limits from the orignal position when looking for a new position to transition to. /// </summary> private Vector3 originalPosition; /// <summary> /// The <see cref="Light"/> component on the <see cref="FireLight"/>. /// </summary> private new Light light; /// <summary> /// The <see cref="Transform"/> component on the <see cref="FireLight"/>. /// </summary> private new Transform transform; private void Awake() { light = GetComponent<Light>(); transform = GetComponent<Transform>(); originalPosition = transform.position; } private void Update() { HandleMovement(); HandleIntensityBreathing(); } /// <summary> /// Handles the movement transition to the <see cref="targetPosition"/>. /// </summary> private void HandleMovement() { // Move to target position transform.position = Vector3.Lerp(transform.position, targetPosition, moveLerpSpeed * Time.deltaTime); if (nextMove <= Time.time) { FindNewPosition(); nextMove = Time.time + moveFrequency; } } /// <summary> /// Finds a new <see cref="targetPosition"/> to transition to. /// </summary> private void FindNewPosition() { float newX = originalPosition.x + Random.Range(xMoveLimit.x, xMoveLimit.y); float newY = originalPosition.y + Random.Range(yMoveLimit.x, yMoveLimit.y); float newZ = originalPosition.z + Random.Range(zMoveLimit.x, zMoveLimit.y); // Find new position targetPosition.Set(newX, newY, newZ); } /// <summary> /// Handles the breathing of the <see cref="FireLight"/> by changing the <see cref="Light.intensity"/> smoothly to the <see cref="targetIntensity"/>. /// </summary> private void HandleIntensityBreathing() { light.intensity = Mathf.Lerp(light.intensity, targetIntensity, intensityLerpSpeed * Time.deltaTime); if (nextIntensity <= Time.time) { FindNewIntensity(); nextIntensity = Time.time + IntensityBreathFrequency; } } /// <summary> /// Finds a new <see cref="targetIntensity"/> to transition to. /// </summary> private void FindNewIntensity() { targetIntensity = Random.Range(minIntensity, maxIntensity); } } }
  2. Hi! While developing on a game of mine, I decided to make a few changes to the camera. I got some inspiration from the camera in Running With Rifles and I really liked it, so I decided to make it like that. Here's a little video of it in action, in my game: Setting it up: Create an empty gameobject, and name it something like Camera Pivot. This is the gameobject that will be moved. Create a camera gameobject, and attach it to the Camera Pivot gameobject Offset the camera gameobject so it points downward, and is a bit in the air Attach the script to the Camera Pivot gameobject. Configure the settings to your likings, and everything should work. If you have any problems, I'll try to help. Script:
  3. Download: SOC - Scriptable Object Creator.unitypackage Added a new video below New update(v2.0): Improved the search algorithm for finding scriptable objects. Moved SOC_Util script into the Editor folder. Added type blacklisting. This feature was added because the Unity's Editor class, and EditorWindow class is deriving from ScriptableObject. That is why classes deriving from Editor or EditorWindow is showing up in the list of ScriptableObjects that can be instantiated. The Editor and the EditorWindow class will be blacklisted by default. Added summaries for methods, fields, and properties in classes. Added a lot of regions in classes. Massive GUI overhaul ORIGINAL - Start Hello, I made a custom editor window so you don't always have to make a script that creates an instance of a scriptable object in your project files I will try to optimize it as much as I can. Not sure how fast it is on big projects. If anyone is trying it on big projects, then please tell me how it ran. I really want to optimize it as well as I can If you find any bugs or have any suggestions, then please tell me PS. If you have any advice to make it better, please tell me. This is also my first time I created a custom editor window ORIGINAL - End Videos:
  4. hello, i am new here. i am trying to build a small unity 2d game. on starting my car will in running and on getting input it will be run right like circle movement. i am stuck how to rotate my car to getting input. thank.
  5. Salutations forum goers. I’m Don, I’ve been a part of the forum for about 3 years now. I’ve worked with Zhavier on Bullet Blackout and few other projects that were never released Anywho I’m working on a fighting game. I’m going to call it Project Lexicon for the time being. In terms of progress a few character models are done and a few tracks of music are done. Right now I really need someone who’s good at C# and can work part time. This would be a paid job. I can pay per assignment, hourly, a combination of any of the two plus rev share, whatever works for you. If you’re interested, send me some of your prior work, or a link to it, and a little bit about yourself. My email: 3dindustriesincorperated@gmail.com
  6. Hello, a bit over an hour ago, I signed up on codefights, and I got to a thing where you have to get the century from year. Which was pretty easy, and there's soo many ways to do it. Anyway, after I came up with a solution, I wanted to see how other people solved it, and the most interesting one I saw were return --year / 100 + 1 How does this work? I know -------------------------------- year = 1800 year / 100 + 1 = 19 expected = 18 -------------------------------- year = 1801 year / 100 + 1 = 19 expected = 19 -------------------------------- but if I add the -- before year, then it will output -------------------------------- year = 1800 --year / 100 + 1 = 18 expected = 18 -------------------------------- year = 1824 --year / 100 + 1 = 19 expected = 19 -------------------------------- How come after -- has been added before year, it all gets decremented kind of like, if year % 100 == 0 then decrement year / 100 + 1. Am I completely off? This just confuses me a bit, and it just makes me nuts, not knowing how it works Please help me to make me understand this, would really appreciate it I have seen it in for loops too(Not often though, only seen it being used in for loops 2 times), like so for(int i = 5; i > 0; --i) { // Blah blah } I have seen it with ++i too
  7. Hello everyone, I am Vadim. Do you not have the knowledge of C# or simply can't find the time to write scripts for your future game? Well, here I am offering to write any Unity C# script you need in no time for as low as 5$, and maximum 15$ for very complex scripts. If you are not be satisfied, you get all your money back guaranteed. So nothing to lose right. I am a Unity C# programmer with 2+ years of experience, very passionate about game development and have developed many different games 2D and 3D. SERVICE LINK: http://www.fiverr.com/technographicpc/write-you-a-unity3d-csharp-script You can also have a look at a small 2D game I have created alone a few months ago: http://gamejolt.com/games/haunted-rescue/221410 Thanks for reading!
  8. Hello, I quickly put together a hunger and thirst script, and I just wanted to share something with you all, and you can use it as you please HungerThirst.cs And here's an example on how you could use it HealthExample.cs
  9. Dardan

    C# Help

    Hello world. Im here to ask one question and hopefully people will write back and take their time to reed this. So my question to the programmers out there is, whats, where and how is the best way to learn Unity C# programming. When i say C# Programming i also mean Network Programming, it is completly okey and ill be really thankful if there isn't a really good unity3d network programming tutorial but only the other type of programming. Anything helps out! I have searched around a lot a lot of to learn programming networking, but don't find so much useful tutorials. I can program a little bit, i have made a basic FPS game by my self and it is really cool in my opinion, but it is boring to play a game where you can't do much but walk around and shoot Ai. So i really wanted to learn Network Programming. Then came this beautiful thing called Unet, or maybe it is old, i dont know, when i say Unet i mean all the new networking components. My experience with multiplayer : The only thing i have completed by using Unet, is making a player join by the NetworkManager / NetworkManagerHUD and walk around and look around in a FPS type of view. And it worked / works. That wasn't so advanced and hard to program, so i thought that it wouldn't be so hard to program in other things like shooting, switching weapons and so on. Oh God it was. So then i ran into this type of thing called [Command] //or Cmd This was new, and it will be new and never be understood by me. I am talking about a lot of other commands and words in Unet programming, but these are the first ones i ran into. So my question is, is there really any good and useful tutorials / streams / courses or whatever it can be, that will help you out in Unity3D C# Programming and Unity3D C# Network Programming ? Thanks in advance for reading all this, thank you for your time and i hope you have a good answer and i hope you have a wonderful day
  10. Hey there, it's been a while since my last post but i really need some help with an assignment in my University. The project, using Visual C# (Visual Studio), is to develop an elevator system for a 5 storey building, i don't care about the design or how to move the elevator and stuff, all i really have to do is to develop the 'right' logic for the elevator so it can choose where to stop in the 'correct' order. My problem is that i can not decide which data structure is needed and how to make the elevator to pick the right order. Translated Assignment: (English might be from weird to really bad) And in any case, of course and i don't want someone to develop this application for me, all i want is some help on which data structure should i use and how to implement a fair elevator logic. I really appreciate your help.
  11. Hi guys. I want to convert a CSharp code to Javascript. It's possible ? The code (CS) : Hashtable setPlayerKills = new Hashtable() {{"Kills", 0}}; PhotonNetwork.player.SetCustomProperties(setPlayerKills); Hashtable setPlayerDeaths = new Hashtable() {{"Deaths", 0}}; PhotonNetwork.player.SetCustomProperties(setPlayerDeaths);
  12. Heya! I want to make a script to Walljump like in the game FORGE( https://www.youtube.com/watch?v=rsCWZmahIwo ). I've been trying a few tricks but as I lack knowledge I need some help. This is what I got: void OnCollisionEnter(Collision collision) { if (onGround == false && collision.transform.tag == "WallJump" ) { if(Input.GetButton("Jump")){ this.gameObject.transform.Translate(Vector3.up * 1,Space.World); this.gameObject.transform.Translate(Vector3.left * 2,Space.World); Debug.Log("Success"); } } }
  13. I need help with this: I Want to change the layer of the soldier (and it works!) and the weapon (this not work). This is the order of the childs: This is my code: using UnityEngine; using System.Collections; public class Network2 : Photon.MonoBehaviour { private string roomName = ""; private string maxRoomPlayerstring = "1"; private int maxRoomPlayers = 1; public GameObject playerObject; public GameObject Spawn; // Use this for initialization void Start () { PhotonNetwork.ConnectUsingSettings("0.0.5 Dev"); } void OnGUI (){ GUILayout.Label(PhotonNetwork.connectionStateDetailed.ToString()); if (PhotonNetwork.insideLobby == true){ GUI.BeginGroup(new Rect(0, 0, Screen.width/2,Screen.height)); GUI.Box(new Rect(0, 0, Screen.width/2-60,Screen.height),"Join a game!"); foreach (RoomInfo room in PhotonNetwork.GetRoomList()) { GUILayout.Box(room.name + " " + room.playerCount + "/" + room.maxPlayers); if(GUILayout.Button("Join Room")){ PhotonNetwork.JoinRoom(room.name); } } roomName = GUI.TextField(new Rect(0,Screen.height-70,Screen.width/2-120,20),roomName,25); maxRoomPlayerstring = GUI.TextField(new Rect (Screen.width/2-100,Screen.height-70,20,20),maxRoomPlayerstring,2); if(maxRoomPlayerstring !=""){ maxRoomPlayers = int.Parse(maxRoomPlayerstring); if(maxRoomPlayers > 20) maxRoomPlayerstring = "20"; if(maxRoomPlayers < 1) maxRoomPlayerstring = "1"; } if(GUI.Button(new Rect(0,Screen.height-50,Screen.width/2-60,50),"Create a new room")){ if(roomName !=""){ PhotonNetwork.CreateRoom(roomName, true, true, maxRoomPlayers); } } GUI.EndGroup(); } } void OnJoinedRoom () { //destroy the main menu cam Destroy(playerObject); //Enalbe local player interaction GameObject Player = (GameObject)PhotonNetwork.Instantiate("Soldier",Spawn.transform.position,Spawn.transform.rotation,0); ((MonoBehaviour)Player.GetComponent ("MouseLook")).enabled = true; ((MonoBehaviour)Player.GetComponent ("FPSInputController")).enabled = true; ((MonoBehaviour)Player.GetComponent ("Movementanim")).enabled = true; ((MonoBehaviour)Player.GetComponent ("CharacterMotor")).enabled = true; Player.transform.FindChild("PSoldier").gameObject.SetActive(true); Player.transform.FindChild("Soldier").gameObject.layer = 8; //Here is the problem Player.transform.FindChild ("Ak 47").gameObject.layer = 8; Player.layer = 8; } }
  14. Hello all.. I'm messing around with a third Person shooter.. But when my weapon reloads its instant.. So i was hoping to put a "WaitForSeconds" in the reload function but since its C# I'm really not sure how to execute it. This is the reload part. private void Reload() { Debug.Log("Reload [" + weaponsSet[weaponIndex].weaponName+"]"); int needBullets = (weaponsSet[weaponIndex].clipSize - weaponsSet[weaponIndex].currentBulletsCount); if (weaponsSet[weaponIndex].haveBullets >= needBullets){ weaponsSet[weaponIndex].haveBullets -= needBullets; weaponsSet[weaponIndex].currentBulletsCount = weaponsSet[weaponIndex].clipSize; } else{ weaponsSet[weaponIndex].currentBulletsCount = weaponsSet[weaponIndex].haveBullets; weaponsSet[weaponIndex].haveBullets = 0; } } I have a variable public float reloadTime; I did some searching and found this. yield return new WaitForSeconds(reloadTime); but this throws a error The body of `WeaponController.Reload()' cannot be an iterator block because `void' is not an iterator interface type Also, If i replace Void Reload() with IEnumerator Reload() I get even more errors.. So im unsure what to do Hopefully someone can help me out.. if you need more info let me know
  • Create New...