Commit bd9c44e1 authored by Sally552sally's avatar Sally552sally
Browse files

внес мелкие правки в коэффициенты

parent d96c4931
No related merge requests found
Showing with 358 additions and 106 deletions
+358 -106
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Mobile/NewSurfaceShader"
{
Properties{
_MainTex("Base", 2D) = "white" {}
_MainColor("Color", Color) = (1.0, 1.0, 1.0, 1.0)
}
CGINCLUDE
#include "UnityCG.cginc"
sampler2D _MainTex;
fixed4 _MainColor;
half4 _MainTex_ST;
struct v2f {
half4 pos : SV_POSITION;
half2 uv : TEXCOORD0;
fixed4 vertexColor : COLOR;
};
v2f vert(appdata_full v) {
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
o.uv.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
o.vertexColor = v.color * _MainColor;
return o;
}
fixed4 frag(v2f i) : COLOR{
return tex2D(_MainTex, i.uv.xy) * i.vertexColor;
}
ENDCG
SubShader {
Tags{ "RenderType" = "Transparent" "Queue" = "Transparent+100" }
Cull Off
Lighting Off
ZWrite Off
ZTest Always
Fog{ Mode Off }
Blend SrcAlpha OneMinusSrcAlpha
Pass{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
ENDCG
}
}
FallBack Off
}
fileFormatVersion: 2
guid: af6897706a959284e9a5d5f10af4ff72
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
%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: ColoredSight
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
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
- _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: 0, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
fileFormatVersion: 2
guid: 2a2182215c4585a46bdb998b0d983480
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
%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: ColoredTarget
m_Shader: {fileID: 4800000, guid: af6897706a959284e9a5d5f10af4ff72, type: 3}
m_ShaderKeywords:
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
- _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}
- _MainColor: {r: 0.034243584, g: 0, b: 1, a: 1}
fileFormatVersion: 2
guid: d4af205d7af3f404a8f2c63c61d2ee18
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
......@@ -207,7 +207,8 @@ MonoBehaviour:
targetCube: {fileID: 1616708582}
floor: {fileID: 0}
DestroyBlock: {fileID: 0}
target: {fileID: 8036151447021700975}
targetGO: {fileID: 8036151447021700975}
sightGO: {fileID: 8838980107319391143}
--- !u!1 &2796261423409998429
GameObject:
m_ObjectHideFlags: 0
......@@ -240,6 +241,7 @@ Transform:
- {fileID: 1619206529}
- {fileID: 1616708583}
- {fileID: 8036151447021700975}
- {fileID: 8838980107319391143}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -303,6 +305,84 @@ MonoBehaviour:
m_EditorClassIdentifier:
handController: {fileID: 1619206530}
targetCube: {fileID: 1616708582}
--- !u!1 &3422992396429078785
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8838980107319391143}
- component: {fileID: 677674767501537544}
- component: {fileID: 7404546275973740015}
m_Layer: 0
m_Name: Sight
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8838980107319391143
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3422992396429078785}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 1}
m_LocalScale: {x: 0.02, y: 0.02, z: 0.02}
m_Children: []
m_Father: {fileID: 2796261423409998426}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &677674767501537544
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3422992396429078785}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &7404546275973740015
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3422992396429078785}
m_Enabled: 0
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 2a2182215c4585a46bdb998b0d983480, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!1 &5435838736844336212
GameObject:
m_ObjectHideFlags: 0
......@@ -330,8 +410,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5435838736844336212}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -0.04, y: 0, z: 1}
m_LocalScale: {x: 0.03, y: 0.03, z: 0.03}
m_LocalPosition: {x: -0.03, y: 0, z: 1}
m_LocalScale: {x: 0.02, y: 0.02, z: 0.02}
m_Children: []
m_Father: {fileID: 2796261423409998426}
m_RootOrder: 4
......@@ -361,7 +441,7 @@ MeshRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 80bd19d68c4ef4a659db43cfb6b09b91, type: 2}
- {fileID: 2100000, guid: d4af205d7af3f404a8f2c63c61d2ee18, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
......@@ -394,4 +474,4 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b14463c1c6c51804590a4101d8e10985, type: 3}
m_Name:
m_EditorClassIdentifier:
cameraTarget: {fileID: 0}
cameraTarget: {fileID: 8838980107319391143}
......@@ -4938,84 +4938,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 341154360}
m_CullTransparentMesh: 0
--- !u!1 &356722776
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 356722777}
- component: {fileID: 356722779}
- component: {fileID: 356722778}
m_Layer: 0
m_Name: Sight
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &356722777
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 356722776}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 1}
m_LocalScale: {x: 0.03, y: 0.03, z: 0.03}
m_Children: []
m_Father: {fileID: 1966958190}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!23 &356722778
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 356722776}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 65fb5c4ce7e4e4e1bbd063bbb561cde7, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &356722779
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 356722776}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &359568348
GameObject:
m_ObjectHideFlags: 0
......@@ -14506,7 +14428,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!114 &1023313471
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -33541,7 +33463,6 @@ Transform:
m_Children:
- {fileID: 1134226949}
- {fileID: 1195426084}
- {fileID: 356722777}
m_Father: {fileID: 1871225459}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -38887,11 +38808,6 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8744002135349357809, guid: 0a3837193bc7899469035caad6857474,
type: 3}
propertyPath: cameraTarget
value:
objectReference: {fileID: 356722777}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 0a3837193bc7899469035caad6857474, type: 3}
--- !u!1 &6725623173037791993 stripped
......@@ -112,7 +112,7 @@ public class RayCastSystem : JobComponentSystem
EntityQuery mouseGroup;
BuildPhysicsWorld buildPhysicsWorldSystem;
public Vector3 Point { get; private set; }
public JobHandle? PickJobHandle;
protected override void OnCreate()
......@@ -161,6 +161,7 @@ public class RayCastSystem : JobComponentSystem
Debug.Log(haveHit);
if (haveHit)
{
Point = hit.Position;
var EntityHit = physicsWorldSystem.PhysicsWorld.Bodies[hit.RigidBodyIndex].Entity;
var EntityPos = EntityManager.GetComponentData<Translation>(EntityHit).Value;
currentEntity = EntityHit;
......@@ -179,6 +180,7 @@ public class RayCastSystem : JobComponentSystem
if (Physics.Raycast(Camera.main.transform.position, target, out hitInfo, k_MaxDistance) &&
hitInfo.transform.tag.Equals(tagFloor))
{
Point = hitInfo.point;
return hitInfo.point;
}
return Vector3.positiveInfinity;
......
......@@ -27,7 +27,9 @@ public class PointAndClickUX : MonoBehaviour
private Transform DestroyBlockActive;
[SerializeField]
private Transform target;
private Transform targetGO;
[SerializeField]
private Transform sightGO;
public bool IsDeleteBlock
{
......@@ -81,17 +83,11 @@ public class PointAndClickUX : MonoBehaviour
private void BuildBlock()
{
targetPosition = rayCastSystem.GetNewEntityPosition(target.position);
Debug.Log("new entity: " + targetPosition);
if (targetPosition.x == Mathf.Infinity)
{
var floorRaycastPosition = rayCastSystem.GetFloorRaycastPoint(floor.tag, target.position);
Debug.Log("RayCastFloor: " + floorRaycastPosition);
if (grid != null)
targetPosition = grid.GetBlockWorldPosition(floorRaycastPosition);
else
targetPosition = new Vector3(floorRaycastPosition.x, floorRaycastPosition.y, floorRaycastPosition.z);
}
targetPosition = GetRaycastHitPosition(targetGO.position);
var cameraPosition = GetRaycastHitPosition(Vector3.zero);
cameraPosition = rayCastSystem.Point;
if (cameraPosition.x != Mathf.Infinity)
sightGO.position = cameraPosition;
if (ClickOutsideUI())
if (targetPosition.x != Mathf.Infinity)
{
......@@ -118,6 +114,20 @@ public class PointAndClickUX : MonoBehaviour
}
private Vector3 GetRaycastHitPosition(Vector3 position)
{
var hit = rayCastSystem.GetNewEntityPosition(position);
if (hit.x == Mathf.Infinity)
{
var floorRaycastPosition = rayCastSystem.GetFloorRaycastPoint(floor.tag, position);
if (grid != null)
hit = grid.GetBlockWorldPosition(floorRaycastPosition);
else
hit = new Vector3(floorRaycastPosition.x, floorRaycastPosition.y, floorRaycastPosition.z);
}
return hit;
}
private void ResetPosition()
{
targetCube.transform.position = Vector3.one * -999;
......
......@@ -8,16 +8,16 @@ public class SmoothDampTarget : MonoBehaviour
private Transform cameraTarget;
private const float smoothTime = 1f;
private const float maxDistance = 0.1f;
private const float maxDistance = 0.072f;
private Vector3 velosity = Vector3.zero;
private void Update()
{
transform.position = Vector3.SmoothDamp(transform.position, cameraTarget.position, ref velosity, smoothTime);
transform.position = new Vector3(
Mathf.Clamp(transform.position.x, cameraTarget.transform.position.x - maxDistance, cameraTarget.transform.position.x + maxDistance),
Mathf.Clamp(transform.position.y, cameraTarget.transform.position.y - maxDistance, cameraTarget.transform.position.y + maxDistance),
Mathf.Clamp(transform.position.z, cameraTarget.transform.position.z - maxDistance, cameraTarget.transform.position.z + maxDistance));
transform.position = Vector3.SmoothDamp(transform.position, cameraTarget.position, ref velosity, smoothTime);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment