Make a lighting system

This commit is contained in:
Sofia 2019-08-21 23:14:23 +03:00
parent a6de20c18b
commit aab4c4c71f
31 changed files with 2465 additions and 284 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

View File

@ -0,0 +1,115 @@
fileFormatVersion: 2
guid: 862e936b1241ab34189839d6406421bf
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 1000
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

View File

@ -0,0 +1,115 @@
fileFormatVersion: 2
guid: 437c2bf9b46474a4ea2792b668192108
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 32
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -10,21 +10,21 @@ MonoBehaviour:
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bf2edee5c58d82540a51f03df9d42094, type: 3} m_Script: {fileID: 11500000, guid: bf2edee5c58d82540a51f03df9d42094, type: 3}
m_Name: LightweightRenderPipelineAsset m_Name: Asset
m_EditorClassIdentifier: m_EditorClassIdentifier:
k_AssetVersion: 4 k_AssetVersion: 4
m_RendererType: 1 m_RendererType: 0
m_RendererData: {fileID: 11400000, guid: 618d298269e66c542b306de85db1faea, type: 2} m_RendererData: {fileID: 11400000, guid: ed942d5de2d8d9141837ed7b128fd548, type: 2}
m_RequireDepthTexture: 0 m_RequireDepthTexture: 0
m_RequireOpaqueTexture: 0 m_RequireOpaqueTexture: 0
m_OpaqueDownsampling: 1 m_OpaqueDownsampling: 1
m_SupportsHDR: 0 m_SupportsHDR: 0
m_MSAA: 1 m_MSAA: 1
m_RenderScale: 1 m_RenderScale: 0.83
m_MainLightRenderingMode: 1 m_MainLightRenderingMode: 0
m_MainLightShadowsSupported: 1 m_MainLightShadowsSupported: 0
m_MainLightShadowmapResolution: 2048 m_MainLightShadowmapResolution: 2048
m_AdditionalLightsRenderingMode: 1 m_AdditionalLightsRenderingMode: 0
m_AdditionalLightsPerObjectLimit: 4 m_AdditionalLightsPerObjectLimit: 4
m_AdditionalLightShadowsSupported: 0 m_AdditionalLightShadowsSupported: 0
m_AdditionalLightsShadowmapResolution: 512 m_AdditionalLightsShadowmapResolution: 512

View File

@ -10,7 +10,7 @@ MonoBehaviour:
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 11145981673336645838492a2d98e247, type: 3} m_Script: {fileID: 11500000, guid: 11145981673336645838492a2d98e247, type: 3}
m_Name: New 2D Renderer Data m_Name: Renderer
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_RendererFeatures: [] m_RendererFeatures: []
m_HDREmulationScale: 1 m_HDREmulationScale: 1

View File

@ -102,7 +102,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 978bec54408eb8f42a36fd68d7447f5a, type: 3} m_Script: {fileID: 11500000, guid: 978bec54408eb8f42a36fd68d7447f5a, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Movement: {fileID: 4248768674552437703}
BehaviourDisplay: {fileID: 8912829886182716132} BehaviourDisplay: {fileID: 8912829886182716132}
CurrentBehaviour: Nothing CurrentBehaviour: Nothing
--- !u!114 &3068808787720623988 --- !u!114 &3068808787720623988
@ -135,7 +134,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ba61752571d0d70478c63122f73914db, type: 3} m_Script: {fileID: 11500000, guid: ba61752571d0d70478c63122f73914db, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Body: {fileID: 592487110401094195}
Bobbing: {fileID: 3068808787720623988} Bobbing: {fileID: 3068808787720623988}
Direction: {x: 0, y: 0} Direction: {x: 0, y: 0}
MaxSpeed: 5 MaxSpeed: 5
@ -294,7 +292,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
- {fileID: 2100000, guid: 76742abfacd1b17458fbe21d2628ca75, type: 2} - {fileID: 2100000, guid: 03e6674a6969c5845b4d97a399c6a451, type: 2}
m_StaticBatchInfo: m_StaticBatchInfo:
firstSubMesh: 0 firstSubMesh: 0
subMeshCount: 0 subMeshCount: 0

View File

@ -0,0 +1,47 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &8372676600519334686
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8372676600519334684}
- component: {fileID: 8372676600519334687}
m_Layer: 0
m_Name: LightUpdater
m_TagString: LightUpdater
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8372676600519334684
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8372676600519334686}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -15.2411585, y: 5.15044, z: -17.707031}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &8372676600519334687
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8372676600519334686}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e334496e2ca1b424da757d217d0f9009, type: 3}
m_Name:
m_EditorClassIdentifier:
Material: {fileID: 2100000, guid: 03e6674a6969c5845b4d97a399c6a451, type: 2}
ParticleMat: {fileID: 2100000, guid: f8c4002dba4187d44a0150e452228fe3, type: 2}

View File

@ -1,8 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 76742abfacd1b17458fbe21d2628ca75 guid: 23a8a2a7bc3c60c47b11e791f5f082c9
NativeFormatImporter: PrefabImporter:
externalObjects: {} externalObjects: {}
mainObjectFileID: 2100000
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -15,9 +15,11 @@ namespace Saltosion.OneWeapon.Effects {
private float ScreenShakeIntensity = 0.0f; private float ScreenShakeIntensity = 0.0f;
private float TimeStopCooldown = 0.0f; private float TimeStopCooldown = 0.0f;
private Vector3 DummyPosition;
private void Start() { private void Start() {
Offset = CameraTransform.position; Offset = CameraTransform.position;
CameraTransform.position = Player.position + Offset; DummyPosition = Player.position + Offset;
} }
private void Update() { private void Update() {
@ -29,7 +31,8 @@ namespace Saltosion.OneWeapon.Effects {
} }
Vector2 TargetPosition = (Player.position * 2f + Camera.ScreenToWorldPoint(Input.mousePosition)) / 3.0f; Vector2 TargetPosition = (Player.position * 2f + Camera.ScreenToWorldPoint(Input.mousePosition)) / 3.0f;
CameraTransform.position = Vector3.Lerp(CameraTransform.position, TargetPosition, 5f * Time.deltaTime / Time.timeScale) + Offset; DummyPosition = Vector3.Lerp(DummyPosition, TargetPosition, 5f * Time.deltaTime / Time.timeScale) + Offset;
CameraTransform.position = new Vector3(Mathf.Floor(DummyPosition.x * 100) / 100, Mathf.Floor(DummyPosition.y * 100) / 100, Mathf.Floor(DummyPosition.z));
if (ScreenShakeTime > 0) { if (ScreenShakeTime > 0) {
ScreenShakeTime -= Time.deltaTime; ScreenShakeTime -= Time.deltaTime;

View File

@ -0,0 +1,26 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Saltosion.OneWeapon.Utils;
namespace Saltosion.OneWeapon.Effects {
[ExecuteInEditMode]
public class CustomLight : MonoBehaviour {
[Range(0, 20)]
public float LightSize = 10;
[Range(0, 2)]
public float LightIntensity = 1;
public Color LightTint = new Color(1, 1, 1, 1);
private LightUpdater Updater;
void Start() {
Updater = GameObject.FindGameObjectWithTag("LightUpdater").GetComponent<LightUpdater>();
Updater.RegisterLight(this);
}
void OnDestroy() {
Updater.UnregisterLight(this);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ddad1ebb72ff9484db3585dbc08a3bea
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 437c2bf9b46474a4ea2792b668192108, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,57 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Saltosion.OneWeapon.Effects;
namespace Saltosion.OneWeapon.Utils {
[ExecuteInEditMode]
public class LightUpdater : MonoBehaviour {
public Material Material;
public Material ParticleMat;
[HideInInspector]
private List<CustomLight> Lights = new List<CustomLight>();
void Update() {
Vector4[] PosList = new Vector4[500];
float[] IntensityList = new float[500];
float[] SizeList = new float[500];
Color[] ColorList = new Color[500];
for (int i = 0; i < Lights.Count; i++) {
PosList[i] = Lights[i].transform.position;
IntensityList[i] = Lights[i].LightIntensity;
SizeList[i] = Lights[i].LightSize;
ColorList[i] = Lights[i].LightTint;
}
Material.SetInt("_LightCount", Lights.Count);
Material.SetVectorArray("_LightLocations", PosList);
Material.SetFloatArray("_LightIntensities", IntensityList);
Material.SetFloatArray("_LightSizes", SizeList);
Material.SetColorArray("_LightColors", ColorList);
ParticleMat.SetInt("_LightCount", Lights.Count);
ParticleMat.SetVectorArray("_LightLocations", PosList);
ParticleMat.SetFloatArray("_LightIntensities", IntensityList);
ParticleMat.SetFloatArray("_LightSizes", SizeList);
ParticleMat.SetColorArray("_LightColors", ColorList);
}
public void RegisterLight(CustomLight Light) {
if (Light != null) {
Lights.Add(Light);
Debug.Log("Got Light!");
}
}
public void UnregisterLight(CustomLight Light) {
int idx = Lights.IndexOf(Light);
if (idx > 0) {
Lights.Remove(Light);
Debug.Log("Removed Light!");
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e334496e2ca1b424da757d217d0f9009
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -7,18 +7,26 @@ Material:
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: New Material m_Name: DefaultMat
m_Shader: {fileID: 4800000, guid: e260cfa7296ee7642b167f1eb5be5023, type: 3} m_Shader: {fileID: 4800000, guid: 1434422345737544399544f3eb31b6f9, type: 3}
m_ShaderKeywords: m_ShaderKeywords: ETC1_EXTERNAL_ALPHA
m_LightmapFlags: 4 m_LightmapFlags: 4
m_EnableInstancingVariants: 0 m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0 m_DoubleSidedGI: 1
m_CustomRenderQueue: -1 m_CustomRenderQueue: -1
stringTagMap: {} stringTagMap: {}
disabledShaderPasses: [] disabledShaderPasses: []
m_SavedProperties: m_SavedProperties:
serializedVersion: 3 serializedVersion: 3
m_TexEnvs: m_TexEnvs:
- _AlphaTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _LightTexture:
m_Texture: {fileID: 2800000, guid: 862e936b1241ab34189839d6406421bf, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex: - _MainTex:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
@ -30,6 +38,14 @@ Material:
- _NormalMap: - _NormalMap:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 1, y: 0}
m_Floats: [] m_Floats:
m_Colors: [] - PixelSnap: 0
- _EnableExternalAlpha: 0
- _Intensity: 0
- _LightCount: 37
m_Colors:
- _AmbientLight: {r: 0, g: 0, b: 0, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Flip: {r: 1, g: 1, b: 1, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}

View File

@ -1,85 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: DefaultSpriteMat
m_Shader: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: ETC1_EXTERNAL_ALPHA
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _AlphaTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- PixelSnap: 0
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EnableExternalAlpha: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Flip: {r: 1, g: 1, b: 1, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: e0ab93c383682b443a6ec30a382d32f5
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,60 +0,0 @@
Shader "Custom/ExplodingSprite"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Intensity ("Intensity", Float) = 1
}
SubShader
{
Tags { "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" "CanUseSpriteAtlas"="true" "PreviewType"="Plane" }
ZWrite Off
Cull Off
Blend One OneMinusSrcAlpha
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile _ PIXELSNAP_ON
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float _Intensity;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.uv);
col.r = min(1, col.r + _Intensity);
col.g = min(1, col.g + _Intensity);
col.b = min(1, col.b + _Intensity);
col.rgb *= col.a;
return col;
}
ENDCG
}
}
}

View File

@ -1,79 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ExplodingSpriteMaterial
m_Shader: {fileID: 4800000, guid: 1434422345737544399544f3eb31b6f9, type: 3}
m_ShaderKeywords: ETC1_EXTERNAL_ALPHA
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _ExplosionIntensity: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Intensity: 0
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -0,0 +1,102 @@
Shader "Custom/GeneralSpriteShader"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
_Intensity ("Intensity", Float) = 1
_LightTexture ("Light Texture", 2D) = "white" {}
_LightCount ("Light Count", Int) = 0
_AmbientLight ("Ambient Light Color", Color) = (0.0, 0.0, 0.0, 1.0)
}
SubShader
{
Tags { "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" "CanUseSpriteAtlas"="true" "PreviewType"="Plane" }
ZWrite Off
Cull Off
Blend One OneMinusSrcAlpha
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile _ PIXELSNAP_ON
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 wp : TEXCOORD1;
};
sampler2D _MainTex;
fixed4 _Color;
float4 _MainTex_ST;
float _Intensity;
sampler2D _LightTexture;
int _LightCount;
float4 _LightLocations[500];
float _LightIntensities[500];
float _LightSizes[500];
fixed4 _LightColors[500];
fixed4 _AmbientLight;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.color = v.color * _Color;
float4 worldpos = mul(unity_ObjectToWorld, v.vertex);
o.wp = float2(worldpos.x, worldpos.y);
return o;
}
fixed4 frag (v2f input) : SV_Target
{
fixed4 total_light_col = _AmbientLight;
[loop]
for (int i = 0; i < _LightCount; i++) {
float size = max(_LightSizes[i], 0.01);
float2 location = float2(_LightLocations[i].x, _LightLocations[i].y);
location = input.wp - location;
location = float2(location.x / size + 0.5, location.y / size + 0.5);
if (location.x < 0 || location.x > 1 || location.y < 0 || location.y > 1) {
continue;
}
fixed4 curr_light_col = tex2D(_LightTexture, location) * _LightIntensities[i];
curr_light_col = fixed4(curr_light_col.rgb * _LightColors[i].rgb * curr_light_col.a, 0);
total_light_col += curr_light_col;
}
fixed4 sprite_col = tex2D(_MainTex, input.uv);
sprite_col = sprite_col * input.color;
fixed4 col = sprite_col * total_light_col;
col = fixed4(col.rgb * col.a + _AmbientLight.rgb, sprite_col.a * _AmbientLight.a);
col.r = min(1, col.r + _Intensity);
col.g = min(1, col.g + _Intensity);
col.b = min(1, col.b + _Intensity);
col.rgb *= col.a;
return col;
}
ENDCG
}
}
}

View File

@ -8,19 +8,21 @@ Material:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: Particle m_Name: Particle
m_Shader: {fileID: 211, guid: 0000000000000000f000000000000000, type: 0} m_Shader: {fileID: 4800000, guid: 1434422345737544399544f3eb31b6f9, type: 3}
m_ShaderKeywords: _ALPHABLEND_ON m_ShaderKeywords: _ALPHATEST_ON
m_LightmapFlags: 0 m_LightmapFlags: 0
m_EnableInstancingVariants: 0 m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0 m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000 m_CustomRenderQueue: -1
stringTagMap: stringTagMap: {}
RenderType: Transparent disabledShaderPasses: []
disabledShaderPasses:
- ALWAYS
m_SavedProperties: m_SavedProperties:
serializedVersion: 3 serializedVersion: 3
m_TexEnvs: m_TexEnvs:
- _AlphaTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap: - _BumpMap:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
@ -41,14 +43,26 @@ Material:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _LightTexture:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex: - _MainTex:
m_Texture: {fileID: 2800000, guid: 0bff8cefb2c5bdc488d3b16a8bdc5159, type: 3} m_Texture: {fileID: 2800000, guid: 0bff8cefb2c5bdc488d3b16a8bdc5159, type: 3}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MaskTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap: - _MetallicGlossMap:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap: - _OcclusionMap:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
@ -58,6 +72,7 @@ Material:
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
m_Floats: m_Floats:
- PixelSnap: 0
- _BlendOp: 0 - _BlendOp: 0
- _BumpScale: 1 - _BumpScale: 1
- _CameraFadingEnabled: 0 - _CameraFadingEnabled: 0
@ -71,15 +86,18 @@ Material:
- _DistortionEnabled: 0 - _DistortionEnabled: 0
- _DistortionStrength: 1 - _DistortionStrength: 1
- _DistortionStrengthScaled: 0 - _DistortionStrengthScaled: 0
- _DstBlend: 10 - _DstBlend: 0
- _EmissionEnabled: 0 - _EmissionEnabled: 0
- _EnableExternalAlpha: 0
- _FlipbookMode: 0 - _FlipbookMode: 0
- _GlossMapScale: 1 - _GlossMapScale: 1
- _Glossiness: 0.5 - _Glossiness: 0.5
- _GlossyReflections: 1 - _GlossyReflections: 1
- _Intensity: 0
- _LightCount: 37
- _LightingEnabled: 0 - _LightingEnabled: 0
- _Metallic: 0 - _Metallic: 0
- _Mode: 2 - _Mode: 1
- _OcclusionStrength: 1 - _OcclusionStrength: 1
- _Parallax: 0.02 - _Parallax: 0.02
- _SmoothnessTextureChannel: 0 - _SmoothnessTextureChannel: 0
@ -87,12 +105,15 @@ Material:
- _SoftParticlesFarFadeDistance: 1 - _SoftParticlesFarFadeDistance: 1
- _SoftParticlesNearFadeDistance: 0 - _SoftParticlesNearFadeDistance: 0
- _SpecularHighlights: 1 - _SpecularHighlights: 1
- _SrcBlend: 5 - _SrcBlend: 1
- _UVSec: 0 - _UVSec: 0
- _ZWrite: 0 - _ZWrite: 1
m_Colors: m_Colors:
- _AmbientLight: {r: 0, g: 0, b: 0, a: 1}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0} - _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 2, g: 2, b: 2, a: 1} - _Color: {r: 3.5648696, g: 3.5648696, b: 3.5648696, a: 1}
- _ColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0} - _ColorAddSubDiff: {r: 1, g: 0, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Flip: {r: 1, g: 1, b: 1, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0} - _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}

View File

@ -41,7 +41,8 @@ GraphicsSettings:
m_PreloadedShaders: [] m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0} type: 0}
m_CustomRenderPipeline: {fileID: 0} m_CustomRenderPipeline: {fileID: 11400000, guid: 366832664f824904189f7529d938cdde,
type: 2}
m_TransparencySortMode: 0 m_TransparencySortMode: 0
m_TransparencySortAxis: {x: 0, y: 0, z: 1} m_TransparencySortAxis: {x: 0, y: 0, z: 1}
m_DefaultRenderingPath: 1 m_DefaultRenderingPath: 1
@ -60,5 +61,5 @@ GraphicsSettings:
m_FogKeepExp: 1 m_FogKeepExp: 1
m_FogKeepExp2: 1 m_FogKeepExp2: 1
m_AlbedoSwatchInfos: [] m_AlbedoSwatchInfos: []
m_LightsUseLinearIntensity: 0 m_LightsUseLinearIntensity: 1
m_LightsUseColorTemperature: 0 m_LightsUseColorTemperature: 0

View File

@ -66,7 +66,7 @@ PlayerSettings:
androidStartInFullscreen: 1 androidStartInFullscreen: 1
androidRenderOutsideSafeArea: 1 androidRenderOutsideSafeArea: 1
androidUseSwappy: 0 androidUseSwappy: 0
androidBlitType: 0 androidBlitType: 1
defaultIsNativeResolution: 1 defaultIsNativeResolution: 1
macRetinaSupport: 1 macRetinaSupport: 1
runInBackground: 1 runInBackground: 1
@ -547,7 +547,17 @@ PlayerSettings:
webGLLinkerTarget: 1 webGLLinkerTarget: 1
webGLThreadsSupport: 0 webGLThreadsSupport: 0
webGLWasmStreaming: 0 webGLWasmStreaming: 0
scriptingDefineSymbols: {} scriptingDefineSymbols:
1: UNITY_POST_PROCESSING_STACK_V2
7: UNITY_POST_PROCESSING_STACK_V2
13: UNITY_POST_PROCESSING_STACK_V2
19: UNITY_POST_PROCESSING_STACK_V2
21: UNITY_POST_PROCESSING_STACK_V2
25: UNITY_POST_PROCESSING_STACK_V2
26: UNITY_POST_PROCESSING_STACK_V2
27: UNITY_POST_PROCESSING_STACK_V2
28: UNITY_POST_PROCESSING_STACK_V2
29: UNITY_POST_PROCESSING_STACK_V2
platformArchitecture: {} platformArchitecture: {}
scriptingBackend: {} scriptingBackend: {}
il2cppCompilerConfiguration: {} il2cppCompilerConfiguration: {}

View File

@ -18,7 +18,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0 shadowmaskMode: 0
blendWeights: 1 skinWeights: 1
textureQuality: 1 textureQuality: 1
anisotropicTextures: 0 anisotropicTextures: 0
antiAliasing: 0 antiAliasing: 0
@ -53,7 +53,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0 shadowmaskMode: 0
blendWeights: 2 skinWeights: 2
textureQuality: 0 textureQuality: 0
anisotropicTextures: 0 anisotropicTextures: 0
antiAliasing: 0 antiAliasing: 0
@ -88,7 +88,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0 shadowmaskMode: 0
blendWeights: 2 skinWeights: 2
textureQuality: 0 textureQuality: 0
anisotropicTextures: 1 anisotropicTextures: 1
antiAliasing: 0 antiAliasing: 0
@ -123,7 +123,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1 shadowmaskMode: 1
blendWeights: 2 skinWeights: 2
textureQuality: 0 textureQuality: 0
anisotropicTextures: 1 anisotropicTextures: 1
antiAliasing: 0 antiAliasing: 0
@ -158,7 +158,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1 shadowmaskMode: 1
blendWeights: 4 skinWeights: 4
textureQuality: 0 textureQuality: 0
anisotropicTextures: 2 anisotropicTextures: 2
antiAliasing: 2 antiAliasing: 2
@ -193,10 +193,10 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1 shadowmaskMode: 1
blendWeights: 4 skinWeights: 4
textureQuality: 0 textureQuality: 0
anisotropicTextures: 2 anisotropicTextures: 2
antiAliasing: 2 antiAliasing: 0
softParticles: 1 softParticles: 1
softVegetation: 1 softVegetation: 1
realtimeReflectionProbes: 1 realtimeReflectionProbes: 1

View File

@ -6,6 +6,7 @@ TagManager:
tags: tags:
- Environment - Environment
- Enemy - Enemy
- LightUpdater
layers: layers:
- Default - Default
- TransparentFX - TransparentFX

BIN
Raw Assets/Light.xcf Normal file

Binary file not shown.

BIN
Raw Assets/LightBulb.xcf Normal file

Binary file not shown.