Merge pull request #34 from dnutiu/some-optimizations
Small Optimizations
This commit is contained in:
commit
66a21fcd9f
4 changed files with 27 additions and 12 deletions
|
@ -68,7 +68,7 @@ SpriteRenderer:
|
|||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 11
|
||||
m_SortingOrder: 10
|
||||
m_Sprite: {fileID: 21300064, guid: 9f5aa0a5274004a2d9ed6d24d3790c5f, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
|
|
|
@ -701,6 +701,10 @@ PrefabInstance:
|
|||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1778702657, guid: d3055091a17dc4aa1accf2e33ccef144, type: 3}
|
||||
propertyPath: m_SortingOrder
|
||||
value: 10
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: d3055091a17dc4aa1accf2e33ccef144, type: 3}
|
||||
--- !u!1001 &7054975846332595845
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using src.Base;
|
||||
using src.Helpers;
|
||||
|
@ -8,6 +9,7 @@ namespace src.Wall
|
|||
{
|
||||
public class WallTransparency : GameplayComponent
|
||||
{
|
||||
public float secondsToWait = 0.1f;
|
||||
private SpriteRenderer _spriteRenderer;
|
||||
private Color _originalSpriteColor;
|
||||
private bool _isTransparent;
|
||||
|
@ -16,21 +18,27 @@ namespace src.Wall
|
|||
{
|
||||
_spriteRenderer = GetComponentInChildren<SpriteRenderer>();
|
||||
_originalSpriteColor = _spriteRenderer.color;
|
||||
StartCoroutine(CheckIfSomethingNear());
|
||||
}
|
||||
|
||||
private void Update()
|
||||
private IEnumerator CheckIfSomethingNear()
|
||||
{
|
||||
var position = transform.position;
|
||||
/* RayCast from the center of the tile up one distance and set layerMask to Player only! */
|
||||
var hit = Physics2D.Raycast(new Vector2(position.x + .5f, position.y + 0.5f),
|
||||
Vector2.up, 1f, 1 << 15);
|
||||
if (hit.collider)
|
||||
while (true)
|
||||
{
|
||||
BecomeTransparent();
|
||||
}
|
||||
else
|
||||
{
|
||||
BecomeOpaque();
|
||||
var position = transform.position;
|
||||
/* RayCast from the center of the tile up one distance and set layerMask to Player only! */
|
||||
var hit = Physics2D.Raycast(new Vector2(position.x + .5f, position.y + 0.5f),
|
||||
Vector2.up, 1f, 1 << 15);
|
||||
if (hit.collider)
|
||||
{
|
||||
BecomeTransparent();
|
||||
}
|
||||
else
|
||||
{
|
||||
BecomeOpaque();
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(secondsToWait);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@ GraphicsSettings:
|
|||
- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_PreloadedShaders: []
|
||||
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
|
||||
type: 0}
|
||||
|
|
Loading…
Reference in a new issue