Browse Source

Added, lightning to rod

master
Joshua Reason 9 years ago
parent
commit
3995f65246
13 changed files with 197 additions and 11 deletions
  1. BIN
      unity_Project/Assets/Character/Character_Animation.controller
  2. BIN
      unity_Project/Assets/Materials/Laser.mat
  3. +31
    -11
      unity_Project/Assets/Scripts/MagnetLaser.cs
  4. +1
    -0
      unity_Project/Assets/Scripts/fence.cs
  5. BIN
      unity_Project/Assets/Standard Assets/ParticleSystems/Textures/txtr_shade_lightning.png
  6. +55
    -0
      unity_Project/Assets/Standard Assets/ParticleSystems/Textures/txtr_shade_lightning.png.meta
  7. BIN
      unity_Project/Assets/Standard Assets/ParticleSystems/Textures/txtr_shade_lightning_textured_TEST.png
  8. +55
    -0
      unity_Project/Assets/Standard Assets/ParticleSystems/Textures/txtr_shade_lightning_textured_TEST.png.meta
  9. BIN
      unity_Project/Assets/Standard Assets/ParticleSystems/Textures/txtr_shade_lightning_textured_TEST_2.png
  10. +55
    -0
      unity_Project/Assets/Standard Assets/ParticleSystems/Textures/txtr_shade_lightning_textured_TEST_2.png.meta
  11. BIN
      unity_Project/Assets/_Scenes/MainLevel.unity
  12. BIN
      unity_Project/Assets/prefabs/Magnet Laser Object PULL.prefab
  13. BIN
      unity_Project/Assets/prefabs/Sign.prefab

BIN
unity_Project/Assets/Character/Character_Animation.controller View File


BIN
unity_Project/Assets/Materials/Laser.mat View File


+ 31
- 11
unity_Project/Assets/Scripts/MagnetLaser.cs View File

@ -4,11 +4,18 @@ using System.Collections;
public class MagnetLaser : MonoBehaviour { public class MagnetLaser : MonoBehaviour {
private LineRenderer lr; private LineRenderer lr;
public GameObject player;
public GameObject rodstart;
public int segments;
public float randomSize;
private magnetGun gun;
// Use this for initialization // Use this for initialization
void Start () { void Start () {
gun = player.GetComponent<magnetGun> ();
lr = GetComponent<LineRenderer> (); lr = GetComponent<LineRenderer> ();
} }
@ -17,24 +24,37 @@ public class MagnetLaser : MonoBehaviour {
// Update is called once per frame // Update is called once per frame
void Update () { void Update () {
if (gun.GravityTarget != null) {
lr.enabled = true;
lr.SetVertexCount(segments+1);
lr.SetPosition(0, rodstart.transform.position);
lr.SetPosition (segments,gun.GravityTarget.transform.position);
Vector3 normalizedV =(gun.GravityTarget.transform.position - player.transform.position);
float distance = normalizedV.magnitude;
//normalizedV.Normalize();
for (int i = 1; i<segments; i++){
Debug.Log(i);
Vector3 point = player.transform.position + (normalizedV/segments)*i;
//startPos.y + (endPos.y - startPos.y) / dis
point.x += Random.Range(-randomSize,randomSize);
point.y += Random.Range(-randomSize,randomSize);
point.z += Random.Range(-randomSize,randomSize);
lr.SetPosition(i,point);
}
// Magnet Laser Collision
RaycastHit hit;
if (Physics.Raycast (transform.position, transform.forward, out hit)) {
} else {
lr.enabled = false;
}
if(hit.collider){
lr.SetPosition(1,new Vector3(0,0,hit.distance));
}
}
else{
lr.SetPosition(1,new Vector3(0,0,100));
}
}
}
} }

+ 1
- 0
unity_Project/Assets/Scripts/fence.cs View File

@ -20,6 +20,7 @@ public class fence : MonoBehaviour {
void OnCollisionEnter(Collision collision) { void OnCollisionEnter(Collision collision) {
if (collision.transform.tag == "moveable") { if (collision.transform.tag == "moveable") {
rigidbody.isKinematic = false; rigidbody.isKinematic = false;
rigidbody.velocity = collision.relativeVelocity;
/* /*
ContactPoint contact = collision.contacts[0]; ContactPoint contact = collision.contacts[0];
Vector3 push = transform.position - contact.point; Vector3 push = transform.position - contact.point;

BIN
unity_Project/Assets/Standard Assets/ParticleSystems/Textures/txtr_shade_lightning.png View File

Before After
Width: 64  |  Height: 64  |  Size: 21 KiB

+ 55
- 0
unity_Project/Assets/Standard Assets/ParticleSystems/Textures/txtr_shade_lightning.png.meta View File

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: 2b5aa2be48f1b7844820115b3fb7cd2e
timeCreated: 1444278447
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

BIN
unity_Project/Assets/Standard Assets/ParticleSystems/Textures/txtr_shade_lightning_textured_TEST.png View File

Before After
Width: 128  |  Height: 128  |  Size: 28 KiB

+ 55
- 0
unity_Project/Assets/Standard Assets/ParticleSystems/Textures/txtr_shade_lightning_textured_TEST.png.meta View File

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: 945653ecdb6934446941aa12d15a7ed9
timeCreated: 1444278448
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

BIN
unity_Project/Assets/Standard Assets/ParticleSystems/Textures/txtr_shade_lightning_textured_TEST_2.png View File

Before After
Width: 64  |  Height: 64  |  Size: 24 KiB

+ 55
- 0
unity_Project/Assets/Standard Assets/ParticleSystems/Textures/txtr_shade_lightning_textured_TEST_2.png.meta View File

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: 75a5bfb36064c8140af87790f9f80ce0
timeCreated: 1444278447
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

BIN
unity_Project/Assets/_Scenes/MainLevel.unity View File


BIN
unity_Project/Assets/prefabs/Magnet Laser Object PULL.prefab View File


BIN
unity_Project/Assets/prefabs/Sign.prefab View File


Loading…
Cancel
Save