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 'newbie'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GENERAL
    • Introduce yourself
    • Discussions
    • Showcase
    • Need help?
    • Seeking team members?
    • Offtopic
  • RESOURCES
    • unity3D | Example Projects
    • unity3D | Scripts
    • unity3D | Shaders
    • unity3D | Tutorials
    • 3D models
    • Animated 3D Models
    • Graphic design
    • Textures
    • Sounds
    • Other
  • FREE FPS PROJECT
    • FPSKit Download
    • FPSKit Modifications/Tutorials
    • FPSKit WIP/Showcase
    • Discussions / Bug reports
  • SELL | REQUEST
    • 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

Categories

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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


YouTube URL


Facebook URL


Twitter URL


IndieGoGo URL


Kickstarter URL


IndieDB URL


GreenLight URL


Location:


Interests

Found 6 results

  1. Hello, my name is Lorenz. About me: I am 17 Years old and i am living in Germany, near Munich, and I am in the 2nd year of my education for software development. Why i am here: Me and my brother had funny ideas for games and since i like programming and he can do good things with Blender we thought it would be fun to start a few small Projects. I recently started to learning C# and Unity and i was looking for a good FPS Controller Asset, since i did not want to play around with the Standard Assets, because it isnt really a good FPS Controller. I found this forum with this good free C# FPS Project and i really liked it and joined. I hope to find support and advice here. Thanks Also, sorry for some english mistake
  2. I fallen in love of YOU Little biography about me: My name is Hermann Vincent, im 18 year old, im live in Réunion Island and also im french, starting first year of university in Science and technology, I am currently in training for being project manager in game development, I love games type realistic role play but i love voxel game too ! When i created some little games for play with my friends, I used Cinema4d but i recently switched to Autodesk(Maya,Revit,3dsmax), I used nodejs with Construct 2. I started using unity since jannuary 2016, but for real december 2016. Its my first biography, dont judge me ahah. Why im on this forum ? I joined the comunity because, SERIOUSLY its fucking sad to never speak of programmation to anyone ! sometime i feel fucking bad, when i want to ask something to my friends about programmation and i know they haven't knowledge in that. OK i stop speak about that. The thing to understand, im not here for make trouble but for communicate, for help novice, for learning and for get fun. Why im falling in love ? Because its the first time i see a beautiful forum like that, someone have helped me and ty ! Hum and i want level up ahah. No seriously ! i think this forum can make me happy, thanks you.
  3. EllisNguyen

    Greeting everyone

    Hi everyone, im Ellis, i wanted to built FPS survival game that can play with friends, i don't know much coding yet, so i hope this community with lots of pro will help me complete my dream of making game xD Thank you.
  4. So i modified some of the scripts in FPS Kit 1.3.5 To suit my needs for a survival horror game and converted the language(not codes) to english I Thought I would contribute to the community by sharing them. (for the new FPS KIT users) /** * Script written by OMA [www.armedunity.com] * Edited for survival horror by Ryan199Gamer **/ @script ExecuteInEditMode() var time : float = 0.0; var hitCrosshairTexture : Texture; private var alphaHit : float; var hitSound : AudioClip; var mySkin : GUISkin; function Update () { if (time > 0){ time -= Time.deltaTime; } alphaHit = time; } function DrawCrosshair(){ yield WaitForSeconds(0.1); time = 1.0; audio.PlayOneShot(hitSound, .5); } function PlayAudioClip (clip : AudioClip, position : Vector3, volume : float) { var go = new GameObject ("TiroAudio"); go.transform.position = position; var source : AudioSource = go.AddComponent (AudioSource); source.clip = clip; source.volume = volume; source.pitch = Random.Range(0.95,1.05); source.Play (); Destroy (go, clip.length); return source; } function OnGUI(){ if(!Screen.lockCursor) return; GUI.skin = mySkin; var style1 = mySkin.customStyles[0]; GUI.color = Color(1.0, 1.0, 1.0, alphaHit); GUI.DrawTexture (Rect ((Screen.width - hitCrosshairTexture.width)/2, (Screen.height - hitCrosshairTexture.height)/2, hitCrosshairTexture.width, hitCrosshairTexture.height), hitCrosshairTexture); } ^Replace this in the "scoreManager" script. var maximumHitPoints = 100.0; var hitPoints = 100.0; var deadReplacement : Rigidbody; var GOPos : GameObject; function ApplyDamage (damage : float) { if (hitPoints <= 0.0) return; // Apply damage hitPoints -= damage; // Are we dead? if (hitPoints <= 0.0) Replace(); } function Replace() { // If we have a dead barrel then replace ourselves with it! if (deadReplacement) { var dead : Rigidbody = Instantiate(deadReplacement, GOPos.transform.position, GOPos.transform.rotation); // For better effect we assign the same velocity to the exploded barrel dead.rigidbody.velocity = rigidbody.velocity; dead.angularVelocity = rigidbody.angularVelocity; } // Destroy ourselves Destroy(gameObject); } ^This with "zombiedamage"script Weapon scripts(In English): /** * Script written by OMA [www.armedunity.com] // edited by BRMASTERGAMES * Edited in English by Ryan199Gamer **/ @script ExecuteInEditMode() enum fireMode { none, semi, auto, burst, launcher} @HideInInspector var currentMode = fireMode.semi; var firstMode = fireMode.semi; var secondMode = fireMode.launcher; enum Ammo { Magazines, Bullets } var ammoMode : Ammo = Ammo.Magazines; var canReloadLauncher : boolean = false; // Weapon Name // var WeaponName : String; var Bala : GameObject; var soundDraw : AudioClip; var soundFire : AudioClip; var soundReload : AudioClip; var soundEmpty : AudioClip; var switchModeSound : AudioClip; var weaponAnim : GameObject; var Concrete : GameObject; var Wood : GameObject; var Metal : GameObject; var Dirt : GameObject; var glass : GameObject; var Blood : GameObject; var BloodMutant : GameObject; var untagged : GameObject; var layerMask : LayerMask; var muzzleFlash : Renderer; var muzzleLight : Light; var damage : int = 50; var bulletsPerMag : int = 50; var magazines : int = 5; private var fireRate : float = 0.1; var fireRateFirstMode : float = 0.1; var fireRateSecondMode : float = 0.1; var reloadTime : float = 3.0; var reloadAnimSpeed : float = 1.2; var drawTime : float = 1.5; var range : float = 250.0; var force : float = 200.0; //Weapon accuracy private var baseInaccuracy : float; var baseInaccuracyAIM : float = 0.005; var baseInaccuracyHIP : float = 1.5; var inaccuracyIncreaseOverTime : float = 0.2; var inaccuracyDecreaseOverTime : float = 0.5; private var maximumInaccuracy : float; var maxInaccuracyHIP : float = 5.0; var maxInaccuracyAIM : float = 1.0; private var triggerTime : float = 0.05; //Aiming var hipPosition : Vector3; var aimPosition : Vector3; private var aiming : boolean; private var curVect : Vector3; var aimSpeed : float = 0.25; var animRun : boolean; //Field Of View var zoomSpeed : float = 0.5; var FOV : int = 40; private var bulletsLeft : int = 0; private var m_LastFrameShot : int = -10; private var nextFireTime : float = 0.0; @HideInInspector var reloading : boolean; private var draw : boolean; private var weaponCamera : GameObject; private var mainCamera : GameObject; private var playing : boolean = false; @HideInInspector var selected : boolean = false; private var player : GameObject; private var isFiring : boolean = false; private var bursting : boolean = false; //Burst var shotsPerBurst : int = 3; var burstTime : float = 0.07; //GUI var mySkin : GUISkin; //Launcher var projectilePrefab : Rigidbody; var projectileSpeed = 30.0; var projectiles = 20; var launchPosition : GameObject; var fireLauncherAnimGO : GameObject; var soundReloadLauncher : AudioClip; private var launcjerReload : boolean = false; var launcherReloadTime : float = 2.0; var reloadlauncher : String = "reloadlauncher"; private var rocket : GameObject; //KickBack var kickGO : Transform; var kickUpside : float = 0.5; var kickSideways : float = 0.5; //Crosshair Textures var crosshairFirstModeHorizontal : Texture2D; var crosshairFirstModeVertical : Texture2D; var crosshairSecondMode : Texture2D; private var adjustMaxCroshairSize : float = 6.0; var CrosshairOn : boolean; //Switch Weapon Fire Modes private var canSwicthMode : boolean = true; var rotation : float; function Start(){ weaponCamera = GameObject.FindWithTag("WeaponCamera"); mainCamera = GameObject.FindWithTag("MainCamera"); player = GameObject.FindWithTag("Player"); muzzleFlash.enabled = false; muzzleLight.enabled = false; bulletsLeft = bulletsPerMag; currentMode = firstMode; fireRate = fireRateFirstMode; aiming = false; animRun = true; if(firstMode == fireMode.launcher){ rocket = GameObject.Find("RPGrocket"); } if(ammoMode == Ammo.Bullets){ magazines = magazines * bulletsPerMag; } } function Update(){ if(selected){ if(Input.GetButton("Run")){ animRun = false; CrosshairOn = false; } if(Input.GetButtonUp("Run")){ animRun = true; CrosshairOn = true; } if(animRun == true){ if (Input.GetButtonDown ("Fire")){ if(currentMode == fireMode.semi){ fireSemi(); } if(currentMode == fireMode.launcher){ fireLauncher(); } if(currentMode == fireMode.burst){ fireBurst(); } if(bulletsLeft > 0) isFiring = true; } if (Input.GetButton ("Fire")){ if(currentMode == fireMode.auto){ fireSemi(); if(bulletsLeft > 0) isFiring = true; } } if(Input.GetButton("Fire2") && Input.GetButton("Fire1") && bulletsLeft > 1){ aiming = false; } if(Input.GetButton("Fire") && bulletsLeft == 0){ Reload(); } if(bulletsLeft == 0){ Reload(); } if (Input.GetButtonDown ("Reload")){ Reload(); } } } if (Input.GetButton("Fire2") && !Input.GetButton ("Run") && !reloading){ if (!aiming){ aiming = true; curVect = aimPosition - transform.localPosition; } if (transform.localPosition != aimPosition && aiming){ if(Mathf.Abs(Vector3.Distance(transform.localPosition , aimPosition)) < curVect.magnitude/aimSpeed * Time.deltaTime){ transform.localPosition = aimPosition; } else { transform.localPosition += curVect/aimSpeed * Time.deltaTime; } } } else { if (aiming){ aiming = false; curVect = hipPosition - transform.localPosition; /* var go = GetComponentsInChildren(Renderer); for( var g : Renderer in go){ if (g.name != "muzzle_flash") g.renderer.enabled = true; } */ } if(Mathf.Abs(Vector3.Distance(transform.localPosition , hipPosition)) < curVect.magnitude/aimSpeed * Time.deltaTime){ transform.localPosition = hipPosition; }else{ transform.localPosition += curVect/aimSpeed * Time.deltaTime; } } if(aiming){ maximumInaccuracy = maxInaccuracyAIM; baseInaccuracy = baseInaccuracyAIM; mainCamera.camera.fieldOfView -= FOV * Time.deltaTime/zoomSpeed; if(mainCamera.camera.fieldOfView < FOV){ mainCamera.camera.fieldOfView = FOV; } weaponCamera.camera.fieldOfView -= 40 * Time.deltaTime/zoomSpeed; if(weaponCamera.camera.fieldOfView < 40){ weaponCamera.camera.fieldOfView = 40; } }else{ maximumInaccuracy = maxInaccuracyHIP; baseInaccuracy = baseInaccuracyHIP; mainCamera.camera.fieldOfView += 60 * Time.deltaTime/0.5; if(mainCamera.camera.fieldOfView > 60){ mainCamera.camera.fieldOfView = 60; } weaponCamera.camera.fieldOfView += 50 * Time.deltaTime/0.5; if(weaponCamera.camera.fieldOfView > 50){ weaponCamera.camera.fieldOfView = 50; } } if(player.rigidbody.velocity.magnitude > 3.0){ triggerTime += inaccuracyDecreaseOverTime; } if(isFiring){ triggerTime += inaccuracyIncreaseOverTime; }else{ if(player.rigidbody.velocity.magnitude < 3.0) triggerTime -= inaccuracyDecreaseOverTime; } if (triggerTime >= maximumInaccuracy) { triggerTime = maximumInaccuracy; } if (triggerTime <= baseInaccuracy) { triggerTime = baseInaccuracy; } if(nextFireTime > Time.time){ isFiring = false; } if(Input.GetButtonDown("switchFireMode") && secondMode != fireMode.none && canSwicthMode){ if(currentMode != firstMode){ FirstFireMode(); }else{ SecondFireMode(); } } } function LateUpdate(){ if (m_LastFrameShot == Time.frameCount){ muzzleFlash.transform.localRotation = Quaternion.AngleAxis(Random.value * 360, Vector3.forward); muzzleFlash.enabled = true; muzzleLight.enabled = true; }else{ muzzleFlash.enabled = false; muzzleLight.enabled = false; } } function OnGUI (){ if(selected){ GUI.skin = mySkin; var style1 = mySkin.customStyles[0]; if(ammoMode == Ammo.Magazines){ if(firstMode != fireMode.none && firstMode != fireMode.launcher || secondMode != fireMode.none && secondMode != fireMode.launcher){ GUI.Label (Rect(Screen.width - 200,Screen.height-35,200,80),"AMMO : "); GUI.Label (Rect(Screen.width - 110,Screen.height-35,200,80),"" + bulletsLeft, style1); GUI.Label (Rect(Screen.width - 80,Screen.height-35,200,80)," | " + magazines, style1); } } if(ammoMode == Ammo.Bullets){ if(firstMode != fireMode.none && firstMode != fireMode.launcher || secondMode != fireMode.none && secondMode != fireMode.launcher){ GUI.Label (Rect(Screen.width - 200,Screen.height-35,200,80),"AMMO : "); GUI.Label (Rect(Screen.width - 110,Screen.height-35,200,80),"" + bulletsLeft, style1); if(bulletsLeft < 6){ var style2 = mySkin.customStyles[1]; GUI.Label (Rect(Screen.width - 110,Screen.height-35,200,80),"" + bulletsLeft, style2); } GUI.Label (Rect(Screen.width - 80,Screen.height-35,200,80)," | " + magazines, style1); } } if(firstMode != fireMode.none || secondMode != fireMode.none){ GUI.Label (Rect(Screen.width - 200,Screen.height-65,200,80),"FireMode:"); GUI.Label (Rect(Screen.width - 110,Screen.height-65,200,80),"" + currentMode, style1); } if(secondMode == fireMode.launcher || firstMode == fireMode.launcher){ GUI.Label (Rect(Screen.width - 200,Screen.height-95,200,80),"GrenadeAmmo: "); GUI.Label (Rect(Screen.width - 110,Screen.height-95,200,80),"" + projectiles, style1); } if(CrosshairOn){ if(crosshairFirstModeHorizontal != null){ if(currentMode != fireMode.launcher){ var w = crosshairFirstModeHorizontal.width; var h = crosshairFirstModeHorizontal.height; position1 = Rect((Screen.width + w)/2 + (triggerTime * adjustMaxCroshairSize),(Screen.height - h)/2, w, h); position2 = Rect((Screen.width - w)/2,(Screen.height + h)/2 + (triggerTime * adjustMaxCroshairSize), w, h); position3 = Rect((Screen.width - w)/2 - (triggerTime * adjustMaxCroshairSize) - w,(Screen.height - h )/2, w, h); position4 = Rect((Screen.width - w)/2,(Screen.height - h)/2 - (triggerTime * adjustMaxCroshairSize) - h, w, h); if (!aiming) { GUI.DrawTexture(position1, crosshairFirstModeHorizontal); //Right GUI.DrawTexture(position2, crosshairFirstModeVertical); //Up GUI.DrawTexture(position3, crosshairFirstModeHorizontal); //Left GUI.DrawTexture(position4, crosshairFirstModeVertical); //Down } } } if(crosshairSecondMode != null){ if(currentMode == fireMode.launcher){ var width = crosshairSecondMode.width/2; var height = crosshairSecondMode.height/2; position = Rect((Screen.width - width)/2,(Screen.height - height )/2, width, height); if (!aiming) { GUI.DrawTexture(position, crosshairSecondMode); } } } } } } function FirstFireMode(){ canSwicthMode = false; selected = false; weaponAnim.animation.Rewind("SwitchAnim"); weaponAnim.animation.Play("SwitchAnim"); audio.clip = switchModeSound; audio.Play(); yield WaitForSeconds(0.6); currentMode = firstMode; fireRate = fireRateFirstMode; selected = true; canSwicthMode = true; } function SecondFireMode(){ canSwicthMode = false; selected = false; audio.clip = switchModeSound; audio.Play(); weaponAnim.animation.Play("SwitchAnim"); yield WaitForSeconds(0.6); currentMode = secondMode; fireRate = fireRateSecondMode; selected = true; canSwicthMode = true; } function fireSemi (){ if (reloading || bulletsLeft <= 0){ if(bulletsLeft == 0){ OutOfAmmo(); } return; } if (Time.time - fireRate > nextFireTime) nextFireTime = Time.time - Time.deltaTime; while(nextFireTime < Time.time){ fireOneBullet(); nextFireTime = Time.time + fireRate; } } function fireLauncher (){ if (reloading || projectiles <= 0){ if(projectiles == 0){ OutOfAmmo(); } return; } if (Time.time - fireRate > nextFireTime) nextFireTime = Time.time - Time.deltaTime; while(nextFireTime < Time.time){ fireProjectile(); nextFireTime = Time.time + fireRate; } } function fireBurst (){ var shotCounter : int = 0; if (reloading || bursting || bulletsLeft <= 0){ if(bulletsLeft <= 0){ OutOfAmmo(); } return; } if (Time.time - fireRate > nextFireTime) nextFireTime = Time.time - Time.deltaTime; if(Time.time > nextFireTime){ while (shotCounter < shotsPerBurst){ bursting = true; shotCounter++; if (bulletsLeft > 0){ fireOneBullet(); } yield WaitForSeconds(burstTime); } nextFireTime = Time.time + fireRate; } bursting = false; } function fireOneBullet (){ if (nextFireTime > Time.time || draw){ if(bulletsLeft <= 0){ OutOfAmmo(); } return; } var direction = gameObject.transform.TransformDirection(Vector3(Random.Range(-0.01, 0.01) * triggerTime, Random.Range(-0.01, 0.01) * triggerTime,1)); var hit : RaycastHit; var position = transform.parent.position; if (Physics.Raycast(position, direction, hit, range, layerMask.value)) { var contact = hit.point; var rotation = Quaternion.FromToRotation(Vector3.up, hit.normal); if (hit.rigidbody){ hit.rigidbody.AddForceAtPosition(force * direction, hit.point); } if (hit.transform.tag == "Untagged") { var default1 = Instantiate (untagged, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); default1.transform.parent = hit.transform; } if (hit.transform.tag == "Concrete") { var bulletHole = Instantiate (Concrete, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); bulletHole.transform.parent = hit.transform; } if (hit.transform.tag == "Wood") { var woodHole = Instantiate (Wood, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); woodHole.transform.parent = hit.transform; } if (hit.transform.tag == "Metal") { var metalHole = Instantiate (Metal, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); metalHole.transform.parent = hit.transform; } if (hit.transform.tag == "Dirt") { var dirtHole = Instantiate (Dirt, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); dirtHole.transform.parent = hit.transform; } if (hit.transform.tag == "glass") { var glassHole = Instantiate (glass, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); glassHole.transform.parent = hit.transform; } if (hit.transform.tag == "canBeUsed") { hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); } if (hit.transform.tag == "Enemy") { hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); yield WaitForSeconds(0.01); var bloodHole = Instantiate (Blood, contact, rotation) as GameObject; if(Physics.Raycast (position, direction, hit, range, layerMask.value)){ if(hit.rigidbody){ hit.rigidbody.AddForceAtPosition(force * direction, hit.point); } } } if (hit.transform.tag == "EnemyMutant") { hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); yield WaitForSeconds(0.02); var bloodMutantHole = Instantiate (BloodMutant, contact, rotation) as GameObject; if(Physics.Raycast (position, direction, hit, range, layerMask.value)){ if(hit.rigidbody){ hit.rigidbody.AddForceAtPosition(force * direction, hit.point); } } } } PlayAudioClip(soundFire, transform.position, 0.7); m_LastFrameShot = Time.frameCount; weaponAnim.animation.Rewind("Fire"); weaponAnim.animation.Play("Fire"); KickBack(); bulletsLeft--; } function PlayAudioClip (clip : AudioClip, position : Vector3, volume : float) { var go = new GameObject ("Bala som"); go.transform.position = position; var source : AudioSource = go.AddComponent (AudioSource); source.clip = clip; source.volume = volume; source.pitch = Random.Range(0.95,1.05); source.Play (); Destroy (go, clip.length); return source; } function fireProjectile (){ if (projectiles < 1 || draw || launcjerReload){ return; } var instantiatedProjectile : Rigidbody = Instantiate (projectilePrefab, launchPosition.transform.position, launchPosition.transform.rotation); fireLauncherAnimGO.animation.Play("FireGL"); instantiatedProjectile.velocity = transform.TransformDirection(Vector3 (0, 0, projectileSpeed)); Physics.IgnoreCollision(instantiatedProjectile.collider, gameObject.FindWithTag("Player").transform.root.collider); projectiles--; if(canReloadLauncher) ReloadLauncher(); } function OutOfAmmo(){ if(reloading || playing) return; playing = true; PlayAudioClip(soundEmpty, transform.position, 0.7); yield WaitForSeconds(0.2); playing = false; } //For RPG function ReloadLauncher(){ if(projectiles > 0){ launcjerReload = true; canSwicthMode = false; DisableProjectileRenderer(); yield WaitForSeconds(0.5); audio.PlayOneShot(soundReloadLauncher); weaponAnim.animation[reloadlauncher].speed = 1.2; weaponAnim.animation.Play(reloadlauncher); yield WaitForSeconds(launcherReloadTime); canSwicthMode = true; launcjerReload = false; }else{ if(rocket != null && projectiles == 0){ rocket.renderer.enabled = false; } } } function DisableProjectileRenderer(){ if(rocket != null){ rocket.renderer.enabled = false; } yield WaitForSeconds(launcherReloadTime/1.5); if(rocket != null){ rocket.renderer.enabled = true; } } function EnableProjectileRenderer(){ if(rocket != null){ rocket.renderer.enabled = true; } } function Reload (){ if(reloading) return; if(ammoMode == Ammo.Magazines){ reloading = true; canSwicthMode = false; if (magazines > 0 && bulletsLeft != bulletsPerMag) { weaponAnim.animation["Reload"].speed = reloadAnimSpeed; weaponAnim.animation.Play("Reload", PlayMode.StopAll); weaponAnim.animation.CrossFade("Reload"); audio.clip = soundReload; audio.Play(); yield WaitForSeconds(reloadTime); magazines --; bulletsLeft = bulletsPerMag; } reloading = false; canSwicthMode = true; isFiring = false; } if(ammoMode == Ammo.Bullets){ if(magazines > 0 && bulletsLeft != bulletsPerMag){ if(magazines > bulletsPerMag){ canSwicthMode = false; reloading = true; weaponAnim.animation["Reload"].speed = reloadAnimSpeed; weaponAnim.animation.Play("Reload", PlayMode.StopAll); weaponAnim.animation.CrossFade("Reload"); audio.clip = soundReload; audio.Play(); yield WaitForSeconds(reloadTime); magazines -= bulletsPerMag - bulletsLeft; bulletsLeft = bulletsPerMag; canSwicthMode = true; reloading = false; return; }else{ canSwicthMode = false; reloading = true; weaponAnim.animation["Reload"].speed = reloadAnimSpeed; weaponAnim.animation.Play("Reload", PlayMode.StopAll); weaponAnim.animation.CrossFade("Reload"); audio.clip = soundReload; audio.Play(); yield WaitForSeconds(reloadTime); var bullet = Mathf.Clamp(bulletsPerMag, magazines, bulletsLeft + magazines); magazines -= (bullet - bulletsLeft); bulletsLeft = bullet; canSwicthMode = true; reloading = false; return; } } } } function KickBack() { kickGO.localRotation = Quaternion.Euler(kickGO.localRotation.eulerAngles - Vector3(kickUpside, Random.Range(-kickSideways, kickSideways), 0)); } function DrawWeapon(){ addair = gameObject.Find("Player").GetComponent("RigidController"); draw = true; canSwicthMode = false; audio.clip = soundDraw; audio.Play(); weaponAnim.animation.Play("Draw", PlayMode.StopAll); weaponAnim.animation.CrossFade("Draw"); yield WaitForSeconds(drawTime); draw = false; reloading = false; canSwicthMode = true; selected = true; } function Deselect(){ selected = false; animRun = true; CrosshairOn = true; mainCamera.camera.fieldOfView = 60; weaponCamera.camera.fieldOfView = 50; transform.localPosition = hipPosition; } ^"WeaponScriptNew" script /** * Script written by OMA [www.armedunity.com] * Edited for survival horror by Ryan199Gamer **/ //@script ExecuteInEditMode() var WeaponName : String; var soundDraw : AudioClip; var soundFire : AudioClip; var soundReload : AudioClip; var soundGO : GameObject; var soundEmpty : AudioClip; var weaponAnim : GameObject; var Concrete : GameObject; var Wood : GameObject; var Metal : GameObject; var glass : GameObject; var Dirt : GameObject; var Blood : GameObject; var BloodMutant : GameObject; var untagged : GameObject; var layerMask : LayerMask; var muzzleFlash : Renderer; var muzzleLight : Light; var pelletsPerShot : int = 10; var damage : int = 50; var bulletsPerMag : int = 50; var magazines : int = 5; var fireRate : float = 0.1; var reloadTime : float = 3.0; var drawTime : float = 1.5; var range : float = 250.0; var force : float = 200.0; var inacuracy : float = 0.2; //Aiming var hipPosition : Vector3; var aimPosition : Vector3; private var aiming : boolean; private var curVect : Vector3; var aimSpeed : float = 0.25; //Field Of View var zoomSpeed : float = 0.5; var FOV : int = 40; private var bulletsLeft : int = 0; private var m_LastFrameShot : int = -10; private var nextFireTime : float = 0.0; private var reloading : boolean; private var draw : boolean; private var weaponCamera : GameObject; private var mainCamera : GameObject; private var playing : boolean = false; @HideInInspector var selected : boolean = false; //private var player : GameObject; //GUI var mySkin : GUISkin; var animRun : boolean; //KickBack var kickGO : Transform; var kickUpside : float = 0.5; var kickSideways : float = 0.5; //Crosshair Textures var crosshair : Texture2D; function Start(){ weaponCamera = GameObject.FindWithTag("WeaponCamera"); mainCamera = GameObject.FindWithTag("MainCamera"); //player = GameObject.FindWithTag("Player"); muzzleFlash.enabled = false; muzzleLight.enabled = false; bulletsLeft = bulletsPerMag; aiming = false; animRun = true; } function Update(){ if(selected){ if(Input.GetButton("Run")){ animRun = false; } if(Input.GetButtonUp("Run")){ animRun = true; } if(bulletsLeft == 0){ Reload(); } if(animRun == true){ if (Input.GetButtonDown ("Fire")){ FireShotgun(); } if (Input.GetButtonDown ("Reload")){ Reload(); } } } if (Input.GetButton("Fire2") && !Input.GetButton ("Run") && !reloading){ if (!aiming){ aiming = true; curVect = aimPosition - transform.localPosition; } if (transform.localPosition != aimPosition && aiming){ if(Mathf.Abs(Vector3.Distance(transform.localPosition , aimPosition)) < curVect.magnitude/aimSpeed * Time.deltaTime){ transform.localPosition = aimPosition; } else { transform.localPosition += curVect/aimSpeed * Time.deltaTime; } } } else { if (aiming){ aiming = false; curVect = hipPosition-transform.localPosition; var go = GetComponentsInChildren(Renderer); for( var g : Renderer in go){ if (g.name != "muzzle_flash") g.renderer.enabled = true; } } if(Mathf.Abs(Vector3.Distance(transform.localPosition , hipPosition)) < curVect.magnitude/aimSpeed * Time.deltaTime){ transform.localPosition = hipPosition; }else{ transform.localPosition += curVect/aimSpeed * Time.deltaTime; } } if(aiming){ mainCamera.camera.fieldOfView -= FOV * Time.deltaTime/zoomSpeed; if(mainCamera.camera.fieldOfView < FOV){ mainCamera.camera.fieldOfView = FOV; } weaponCamera.camera.fieldOfView -= 40 * Time.deltaTime/zoomSpeed; if(weaponCamera.camera.fieldOfView < 40){ weaponCamera.camera.fieldOfView = 40; } }else{ mainCamera.camera.fieldOfView += 60 * Time.deltaTime/0.5; if(mainCamera.camera.fieldOfView > 60){ mainCamera.camera.fieldOfView = 60; } weaponCamera.camera.fieldOfView += 50 * Time.deltaTime/0.5; if(weaponCamera.camera.fieldOfView > 50){ weaponCamera.camera.fieldOfView = 50; } } } function LateUpdate(){ if (m_LastFrameShot == Time.frameCount){ muzzleFlash.transform.localRotation = Quaternion.AngleAxis(Random.value * 360, Vector3.forward); muzzleFlash.enabled = true; muzzleLight.enabled = true; }else{ muzzleFlash.enabled = false; muzzleLight.enabled = false; } } function OnGUI (){ if(selected){ GUI.skin = mySkin; var style1 = mySkin.customStyles[0]; GUI.Label (Rect(Screen.width - 200,Screen.height-35,200,80),"AMMO : "); GUI.Label (Rect(Screen.width - 110,Screen.height-35,200,80),"" + bulletsLeft, style1); GUI.Label (Rect(Screen.width - 80,Screen.height-35,200,80)," / " + magazines); if(bulletsLeft < 2){ var style2 = mySkin.customStyles[3]; GUI.Label (Rect(Screen.width - 110,Screen.height-35,200,80),"" + bulletsLeft, style2); } if(crosshair != null){ var w = crosshair.width/2; var h = crosshair.height/2; position = Rect((Screen.width - w)/2,(Screen.height - h )/2, w, h); if (!aiming) { GUI.DrawTexture(position, crosshair); } } } } function FireShotgun (){ if (reloading || bulletsLeft <= 0 || draw){ if(bulletsLeft == 0){ OutOfAmmo(); } return; } var pellets : int = 0; if (Time.time - fireRate > nextFireTime) nextFireTime = Time.time - Time.deltaTime; if(Time.time > nextFireTime){ while (pellets < pelletsPerShot){ FireOneShot(); pellets++; } bulletsLeft--; nextFireTime = Time.time + fireRate; KickBack(); } } function FireOneShot (){ var direction = gameObject.transform.TransformDirection(Vector3(Random.Range(-0.01, 0.01) * inacuracy, Random.Range(-0.01, 0.01) * inacuracy,1)); var hit : RaycastHit; var position = transform.parent.position; if (Physics.Raycast (position, direction, hit, range, layerMask.value)) { var contact = hit.point; var rotation = Quaternion.FromToRotation(Vector3.up, hit.normal); if (hit.rigidbody){ hit.rigidbody.AddForceAtPosition(force * direction, hit.point); } if (hit.transform.tag == "Untagged") { var default1 = Instantiate (untagged, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); default1.transform.parent = hit.transform; } if (hit.transform.tag == "Concrete") { var bulletHole = Instantiate (Concrete, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); bulletHole.transform.parent = hit.transform; } if (hit.transform.tag == "Wood") { var woodHole = Instantiate (Wood, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); woodHole.transform.parent = hit.transform; } if (hit.transform.tag == "Metal") { var metalHole = Instantiate (Metal, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); metalHole.transform.parent = hit.transform; } if (hit.transform.tag == "glass") { var glassHole = Instantiate (glass, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); glassHole.transform.parent = hit.transform; } if (hit.transform.tag == "Dirt") { var dirtHole = Instantiate (Dirt, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); dirtHole.transform.parent = hit.transform; } if (hit.transform.tag == "canBeUsed") { hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); } if (hit.transform.tag == "Enemy") { hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); yield WaitForSeconds(0.03); var bloodHole = Instantiate (Blood, contact, rotation) as GameObject; if(Physics.Raycast (position, direction, hit, range, layerMask.value)){ if(hit.rigidbody){ hit.rigidbody.AddForceAtPosition(force * direction, hit.point); } } } if (hit.transform.tag == "EnemyMutant") { hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); yield WaitForSeconds(0.03); var bloodMutantHole = Instantiate (BloodMutant, contact, rotation) as GameObject; if(Physics.Raycast (position, direction, hit, range, layerMask.value)){ if(hit.rigidbody){ hit.rigidbody.AddForceAtPosition(force * direction, hit.point); } } } } if (audio) { audio.clip = soundFire; audio.Play(); } m_LastFrameShot = Time.frameCount; weaponAnim.animation.Rewind("ShotgunFire"); weaponAnim.animation.Play("ShotgunFire"); } function OutOfAmmo(){ if(reloading || playing) return; playing = true; soundGO.audio.clip = soundEmpty; soundGO.audio.volume = 0.7; soundGO.audio.Play(); weaponAnim.animation["Fire"].speed = 2.0; weaponAnim.animation.Play("Fire"); yield WaitForSeconds(0.2); playing = false; } function Reload (){ if(reloading) return; reloading = true; if (magazines > 0 && bulletsLeft < bulletsPerMag) { weaponAnim.animation["ShotgunReload"].speed = .8; weaponAnim.animation.Play("ShotgunReload", PlayMode.StopAll); weaponAnim.animation.CrossFade("ShotgunReload"); audio.PlayOneShot(soundReload); yield WaitForSeconds(reloadTime); magazines--; bulletsLeft = bulletsPerMag; } reloading = false; } function KickBack() { kickGO.localRotation = Quaternion.Euler(kickGO.localRotation.eulerAngles - Vector3(kickUpside, Random.Range(-kickSideways, kickSideways), 0)); } function DrawWeapon(){ draw = true; audio.clip = soundDraw; audio.Play(); weaponAnim.animation.Play("Draw", PlayMode.StopAll); weaponAnim.animation.CrossFade("Draw"); yield WaitForSeconds(drawTime); draw = false; reloading = false; selected = true; } function Deselect(){ selected = false; mainCamera.camera.fieldOfView = 60; weaponCamera.camera.fieldOfView = 50; transform.localPosition = hipPosition; } ^"ShotGunScriptNew"Script /** * Script written by OMA [www.armedunity.com] **/ enum FireMode { semi, auto } var Mode = FireMode.semi; var WeaponName : String; var soundFire : AudioClip; var soundReload : AudioClip; var soundEmpty : AudioClip; var soundDraw : AudioClip; var weaponAnim : GameObject; var Concrete : GameObject; var Wood : GameObject; var Metal : GameObject; var Dirt : GameObject; var glass : GameObject; var Blood : GameObject; var BloodMutant : GameObject; var untagged : GameObject; var layerMask : LayerMask; var muzzleFlash : Renderer; var muzzleLight : Light; var damage : int = 50; var bulletsPerMag : int = 50; var magazines : int = 5; var reloadTime : float = 2; var drawTime = 1.0; private var bulletsLeft = 0; var fireRate : float = 0.1; var range : float = 1000; var force : float = 500; //Weapon accuracy private var baseInaccuracy : float; var inaccuracyIncreaseOverTime : float = 0.01; var inaccuracyDecreaseOverTime : float = 0.5; private var maximumInaccuracy : float; private var triggerTime : float = 0.05; var baseInaccuracyAIM : float = 0.005; var baseInaccuracyHIP : float = 1.5; var maxInaccuracyHIP : float = 5.0; var maxInaccuracyAIM : float = 1.0; //Aiming var hipPosition : Vector3; var aimPosition : Vector3; private var aiming : boolean; private var curVect : Vector3; var CrossOn : boolean; var aimSpeed : float = 0.25; var scopeTime : float; private var inScope : boolean = false; var scopeTexture : Texture; //Field Of View var zoomSpeed : float = 0.5; var FOV : int = 40; //KickBack var kickGO : Transform; var kickUpside : float = 0.5; var kickSideways : float = 0.5; //GUI var mySkin : GUISkin; var animRun : boolean; private var m_LastFrameShot : int = -1; private var nextFireTime = 0.0; private var reloading : boolean; private var draw : boolean; var weaponCamera : GameObject; var mainCamera : GameObject; private var player : GameObject; @HideInInspector var selected : boolean = false; private var isFiring : boolean = false; private var playing : boolean = false; //Crosshair Textures var crosshairFirstModeHorizontal : Texture2D; var crosshairFirstModeVertical : Texture2D; private var adjustMaxCroshairSize : float = 6.0; function Start(){ weaponCamera = GameObject.FindWithTag("WeaponCamera"); mainCamera = GameObject.FindWithTag("MainCamera"); player = GameObject.FindWithTag("Player"); muzzleFlash.enabled = false; muzzleLight.enabled = false; bulletsLeft = bulletsPerMag; aiming = false; animRun = true; rossOn = true; } function Update() { if(selected){ if(Input.GetButton("Run")){ animRun = false; CrossOn = false; } if(Input.GetButtonUp("Run")){ animRun = true; CrossOn = true; } if(animRun == true){ if(Input.GetButtonDown ("Fire")){ if(Mode == FireMode.semi){ fireSniper(); } if(bulletsLeft > 0) isFiring = true; } if (Input.GetButton ("Fire")){ if(Mode == FireMode.auto){ fireSniper(); if(bulletsLeft > 0) isFiring = true; } } } if(Input.GetButton("Fire") && bulletsLeft == 0){ Reload(); } if(bulletsLeft == 0){ Reload(); } if (Input.GetButtonDown ("Reload")){ Reload(); } if (Input.GetButton("Fire2") && !Input.GetButton("Run") && !reloading){ if (!aiming){ aiming = true; curVect = aimPosition - transform.localPosition; scopeTime = Time.time + aimSpeed; } if (transform.localPosition != aimPosition && aiming){ if(Mathf.Abs(Vector3.Distance(transform.localPosition , aimPosition)) < curVect.magnitude/aimSpeed * Time.deltaTime){ transform.localPosition = aimPosition; } else { transform.localPosition += curVect/aimSpeed * Time.deltaTime; } } if (Time.time >= scopeTime && !inScope){ inScope = true; var gos = GetComponentsInChildren(Renderer); for( var go : Renderer in gos){ go.renderer.enabled = false; } } } else { if (aiming){ aiming = false; inScope = false; curVect= hipPosition-transform.localPosition; var go = GetComponentsInChildren(Renderer); for( var g : Renderer in go){ if (g.name != "muzzle_flash") g.renderer.enabled = true; } } if(Mathf.Abs(Vector3.Distance(transform.localPosition , hipPosition)) < curVect.magnitude/aimSpeed*Time.deltaTime){ transform.localPosition = hipPosition; }else{ transform.localPosition += curVect/aimSpeed*Time.deltaTime; } } if(inScope){ maximumInaccuracy = maxInaccuracyAIM; baseInaccuracy = baseInaccuracyAIM; mainCamera.camera.fieldOfView -= FOV * Time.deltaTime/zoomSpeed; if(mainCamera.camera.fieldOfView < FOV){ mainCamera.camera.fieldOfView = FOV; } weaponCamera.camera.fieldOfView -= 40 * Time.deltaTime/zoomSpeed; if(weaponCamera.camera.fieldOfView < 40){ weaponCamera.camera.fieldOfView = 40; } }else{ maximumInaccuracy = maxInaccuracyHIP; baseInaccuracy = baseInaccuracyHIP; mainCamera.camera.fieldOfView += 60 * Time.deltaTime/0.2; if(mainCamera.camera.fieldOfView > 60){ mainCamera.camera.fieldOfView = 60; } weaponCamera.camera.fieldOfView += 50 * Time.deltaTime/0.2; if(weaponCamera.camera.fieldOfView > 50){ weaponCamera.camera.fieldOfView = 50; } } if(player.rigidbody.velocity.magnitude > 3.0){ triggerTime += inaccuracyDecreaseOverTime; } if(isFiring){ triggerTime += inaccuracyIncreaseOverTime; }else{ if(player.rigidbody.velocity.magnitude < 3.0) triggerTime -= inaccuracyDecreaseOverTime; } if (triggerTime >= maximumInaccuracy) { triggerTime = maximumInaccuracy; } if (triggerTime <= baseInaccuracy) { triggerTime = baseInaccuracy; } if(nextFireTime > Time.time){ isFiring = false; } } } function LateUpdate(){ if (m_LastFrameShot == Time.frameCount && !inScope){ muzzleFlash.transform.localRotation = Quaternion.AngleAxis(Random.value * 360, Vector3.forward); muzzleFlash.enabled = true; muzzleLight.enabled = true; }else{ muzzleFlash.enabled = false; muzzleLight.enabled = false; } } function OnGUI (){ if(selected){ GUI.skin = mySkin; var style1 = mySkin.customStyles[0]; if(selected){ GUI.Label (Rect(Screen.width - 200,Screen.height-35,200,80),"Ammo : "); GUI.Label (Rect(Screen.width - 110,Screen.height-35,200,80),"" + bulletsLeft, style1); GUI.Label (Rect(Screen.width - 80,Screen.height-35,200,80)," / " + magazines); } if(bulletsLeft < 4){ var style2 = mySkin.customStyles[3]; GUI.Label (Rect(Screen.width - 110,Screen.height-35,200,80),"" + bulletsLeft, style2); } if(scopeTexture != null && inScope){ GUI.DrawTexture(Rect(0,0,Screen.width,Screen.height), scopeTexture, ScaleMode.StretchToFill); }else{ if(CrossOn){ if(crosshairFirstModeHorizontal != null){ var w = crosshairFirstModeHorizontal.width; var h = crosshairFirstModeHorizontal.height; position1 = Rect((Screen.width + w)/2 + (triggerTime * adjustMaxCroshairSize),(Screen.height - h)/2, w, h); position2 = Rect((Screen.width - w)/2,(Screen.height + h)/2 + (triggerTime * adjustMaxCroshairSize), w, h); position3 = Rect((Screen.width - w)/2 - (triggerTime * adjustMaxCroshairSize) - w,(Screen.height - h )/2, w, h); position4 = Rect((Screen.width - w)/2,(Screen.height - h)/2 - (triggerTime * adjustMaxCroshairSize) - h, w, h); if (!aiming) { GUI.DrawTexture(position1, crosshairFirstModeHorizontal); //Right GUI.DrawTexture(position2, crosshairFirstModeVertical); //Up GUI.DrawTexture(position3, crosshairFirstModeHorizontal); //Left GUI.DrawTexture(position4, crosshairFirstModeVertical); //Down } } } } } } function fireSniper (){ if (reloading || bulletsLeft <= 0){ if(bulletsLeft == 0){ OutOfAmmo(); } return; } if (Time.time - fireRate > nextFireTime) nextFireTime = Time.time - Time.deltaTime; while(nextFireTime < Time.time){ fireOneBullet(); nextFireTime = Time.time + fireRate; } } function fireOneBullet (){ if (nextFireTime > Time.time || draw){ if(bulletsLeft <= 0){ OutOfAmmo(); } return; } var direction = mainCamera.transform.TransformDirection(Vector3(Random.Range(-0.05, 0.05) * triggerTime/3, Random.Range(-0.05, 0.05) * triggerTime/3,1)); var hit : RaycastHit; var position = transform.parent.position; if (Physics.Raycast (position, direction, hit, range, layerMask.value)) { var contact = hit.point; var rotation = Quaternion.FromToRotation(Vector3.up, hit.normal); if (hit.rigidbody){ hit.rigidbody.AddForceAtPosition(force * direction, hit.point); } if(hit.transform.tag == "Fracture"){ hit.transform.GetComponent("SimpleFracture").Fracture(contact,direction, true); } if (hit.transform.tag == "Untagged") { var default1 = Instantiate (untagged, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); default1.transform.parent = hit.transform; } if (hit.transform.tag == "Concrete") { var bulletHole = Instantiate (Concrete, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); bulletHole.transform.parent = hit.transform; } if (hit.transform.tag == "Wood") { var woodHole = Instantiate (Wood, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); woodHole.transform.parent = hit.transform; } if (hit.transform.tag == "glass") { var glassHole = Instantiate (glass, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); glassHole.transform.parent = hit.transform; } if (hit.transform.tag == "Metal") { var metalHole = Instantiate (Metal, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); metalHole.transform.parent = hit.transform; } if (hit.transform.tag == "Dirt") { var dirtHole = Instantiate (Dirt, contact, rotation) as GameObject; hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); dirtHole.transform.parent = hit.transform; } if (hit.transform.tag == "canBeUsed") { hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); } if (hit.transform.tag == "Enemy") { hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); yield WaitForSeconds(0.02); var bloodHole = Instantiate (Blood, contact, rotation) as GameObject; if(Physics.Raycast (position, direction, hit, range, layerMask.value)){ if(hit.rigidbody){ hit.rigidbody.AddForceAtPosition(force * direction, hit.point); } } } if (hit.transform.tag == "EnemyMutant") { hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); yield WaitForSeconds(0.02); var bloodMutantHole = Instantiate (BloodMutant, contact, rotation) as GameObject; if(Physics.Raycast (position, direction, hit, range, layerMask.value)){ if(hit.rigidbody){ hit.rigidbody.AddForceAtPosition(force * direction, hit.point); } } } } PlayAudioClip(soundFire, transform.position, 0.7); m_LastFrameShot = Time.frameCount; weaponAnim.animation.Rewind("sniperFire"); weaponAnim.animation.Play("sniperFire"); bulletsLeft--; KickBack(); } function OutOfAmmo(){ if(reloading || playing) return; playing = true; yield WaitForSeconds(0.2); PlayAudioClip(soundEmpty, transform.position, 0.7); yield WaitForSeconds(0.2); playing = false; } function PlayAudioClip (clip : AudioClip, position : Vector3, volume : float) { var go = new GameObject ("One shot audio"); go.transform.position = position; var source : AudioSource = go.AddComponent (AudioSource); source.clip = clip; source.volume = volume; source.pitch = Random.Range(0.95,1.05); source.Play (); Destroy (go, clip.length); return source; } function Reload (){ if(reloading) return; reloading = true; if (magazines > 0 && bulletsLeft < bulletsPerMag) { weaponAnim.animation["Reload"].speed = 1.0; weaponAnim.animation.Play("Reload", PlayMode.StopAll); weaponAnim.animation.CrossFade("Reload"); audio.clip = soundReload; audio.Play(); yield WaitForSeconds(reloadTime); magazines --; bulletsLeft = bulletsPerMag; } reloading = false; } function DrawWeapon(){ draw = true; audio.clip = soundDraw; audio.Play(); weaponAnim.animation.Play("Draw", PlayMode.StopAll); weaponAnim.animation.CrossFade("Draw"); yield WaitForSeconds(drawTime); draw = false; reloading = false; selected = true; } function KickBack() { kickGO.localRotation = Quaternion.Euler(kickGO.localRotation.eulerAngles - Vector3(kickUpside, Random.Range(-kickSideways, kickSideways), 0)); } function Deselect(){ selected = false; animRun = true; CrossOn = true; mainCamera.camera.fieldOfView = 60; weaponCamera.camera.fieldOfView = 50; inScope = false; transform.localPosition = hipPosition; var go = GetComponentsInChildren(Renderer); for( var g : Renderer in go){ if (g.name != "muzzle_flash") g.renderer.enabled = true; } } ^"SniperScript"Script And remove the "air attack" component from player if you want. HOPE THIS HELPS
  5. A short basic demo of FPS parkour using mecanim. The model was created with MakeHuman. Parkour-intermediate kit by OcularCash ( http://armedunity.com/files/file/16-parkour-intermediate/ ) was used as reference guide.This my first time working with mecanim and blender animations. I would love to hear people's input and tips on how to improve it. Here is a link to the video http://www.youtube.com/watch?v=f0zEoi0Szx0
  6. jag9980

    wht am i doin wrong in dis script?

    i just dont knw whts wrong wid this script? am i not supposed to use "=" in brackets? var battlemode = false; function Start () { camera1.enabled = true; camera2.enabled = false; } function Update () { if (battlemode = true) { camera1.enabled = false; camera2.enabled = true; } else if (battlemode = false;) { camera1.enabled = true; camera2.enabled = false; } }
×