WIP Mirror Collisions

This commit is contained in:
Ava Gaiety Wroten 2020-06-14 11:18:59 -05:00
parent fc128cb53f
commit f033c71a5c
5 changed files with 325 additions and 9 deletions

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:26d166d65453dadceb34345ef02e197615ee369411d286f63896b26d8aa3f471
size 6537

View file

@ -0,0 +1,92 @@
fileFormatVersion: 2
guid: ae38caacb1dc57845a4b7af1e502f24d
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
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: -1
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: 100
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
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
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

@ -219,12 +219,12 @@ PrefabInstance:
- target: {fileID: 2115795504606128410, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
propertyPath: m_LocalPosition.x
value: 8.99
value: -9.87
objectReference: {fileID: 0}
- target: {fileID: 2115795504606128410, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
propertyPath: m_LocalPosition.y
value: 0.02190405
value: -1.51
objectReference: {fileID: 0}
- target: {fileID: 2115795504606128410, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
@ -271,6 +271,85 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2115795504606128415, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
propertyPath: flipDirection
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 0fecd55e0eb9020499d7ba0934555d41, type: 3}
--- !u!1001 &1777748290
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2115795504606128404, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
propertyPath: m_Name
value: Laser Turret (1)
objectReference: {fileID: 0}
- target: {fileID: 2115795504606128409, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
propertyPath: isHorizontal
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2115795504606128410, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
propertyPath: m_LocalPosition.x
value: -0.35
objectReference: {fileID: 0}
- target: {fileID: 2115795504606128410, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
propertyPath: m_LocalPosition.y
value: 4.3
objectReference: {fileID: 0}
- target: {fileID: 2115795504606128410, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2115795504606128410, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2115795504606128410, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2115795504606128410, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2115795504606128410, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2115795504606128410, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 2115795504606128410, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2115795504606128410, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2115795504606128410, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2115795504606128415, guid: 0fecd55e0eb9020499d7ba0934555d41,
type: 3}
propertyPath: flipDirection
@ -278,6 +357,133 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 0fecd55e0eb9020499d7ba0934555d41, type: 3}
--- !u!1 &2114209081
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2114209083}
- component: {fileID: 2114209082}
- component: {fileID: 2114209084}
- component: {fileID: 2114209085}
m_Layer: 0
m_Name: Mirror
m_TagString: Mirror
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &2114209082
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2114209081}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
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: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: ae38caacb1dc57845a4b7af1e502f24d, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 9, y: 9}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &2114209083
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2114209081}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -2.19, y: 0.07, z: 0}
m_LocalScale: {x: 0.2, y: 0.2, z: 0.2}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2114209084
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2114209081}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 204ecfc2ca6a5b041bf57b20c63a189c, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!60 &2114209085
PolygonCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2114209081}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 9, y: 9}
newSize: {x: 9, y: 9}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Points:
m_Paths:
- - {x: 4.46, y: 4.5}
- {x: 4.42, y: 4.46}
- {x: 1.1, y: 1.13}
- {x: -4.5, y: -4.47}
- {x: -4.5, y: -4.5}
- {x: 4.5, y: -4.5}
- {x: 4.5, y: 4.5}
--- !u!1001 &4683683891847250626
PrefabInstance:
m_ObjectHideFlags: 0

View file

@ -28,21 +28,35 @@ public class Laser : MonoBehaviour
float endpointY = flipDirection ? transform.position.y - maxDistance : transform.position.y + maxDistance;
hit = Physics2D.Raycast(transform.position, flipDirection ? Vector2.down : Vector2.up);
if (hit.collider) endpointY = hit.collider.transform.position.y;
laserLine.SetPosition(1, new Vector3(transform.position.x, endpointY, 0));
if (hit.collider) laserLine.SetPosition(1, hit.point);
else laserLine.SetPosition(1, new Vector3(transform.position.x, endpointY, 0));
} else
{
float endpointX = flipDirection ? transform.position.x - maxDistance : transform.position.x + maxDistance;
hit = Physics2D.Raycast(transform.position, flipDirection ? Vector2.left : Vector2.right);
if (hit.collider) endpointX = hit.collider.transform.position.x;
laserLine.SetPosition(1, new Vector3(endpointX, transform.position.y, 0));
if (hit.collider) laserLine.SetPosition(1, hit.point);
else laserLine.SetPosition(1, new Vector3(endpointX, transform.position.y, 0));
}
if (hit.collider && hit.collider.tag == "Charge Point")
if (hit.collider)
{
if (hit.collider.gameObject != lastChargePoint) hit.collider.GetComponent<ChargePoint>().adjustCharges(power);
lastChargePoint = hit.collider.gameObject;
if (hit.collider.tag == "Mirror")
{
Debug.Log("Hit Mirror");
if (isHorizontal)
{
// TODO
} else
{
// TODO
}
}
if (hit.collider.tag == "Charge Point")
{
if (hit.collider.gameObject != lastChargePoint) hit.collider.GetComponent<ChargePoint>().adjustCharges(power);
lastChargePoint = hit.collider.gameObject;
}
} else
{
if (lastChargePoint) lastChargePoint.GetComponent<ChargePoint>().adjustCharges(power * -1);

View file

@ -6,6 +6,7 @@ TagManager:
tags:
- Charge Point
- Charge Counter
- Mirror
layers:
- Default
- TransparentFX