Merge pull request #34 from dnutiu/some-optimizations

Small Optimizations
This commit is contained in:
Denis-Cosmin Nutiu 2019-06-22 15:23:39 +03:00 committed by GitHub
commit 66a21fcd9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 12 deletions

View file

@ -68,7 +68,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 11 m_SortingOrder: 10
m_Sprite: {fileID: 21300064, guid: 9f5aa0a5274004a2d9ed6d24d3790c5f, type: 3} m_Sprite: {fileID: 21300064, guid: 9f5aa0a5274004a2d9ed6d24d3790c5f, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0 m_FlipX: 0

View file

@ -701,6 +701,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1778702657, guid: d3055091a17dc4aa1accf2e33ccef144, type: 3}
propertyPath: m_SortingOrder
value: 10
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d3055091a17dc4aa1accf2e33ccef144, type: 3} m_SourcePrefab: {fileID: 100100000, guid: d3055091a17dc4aa1accf2e33ccef144, type: 3}
--- !u!1001 &7054975846332595845 --- !u!1001 &7054975846332595845

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using src.Base; using src.Base;
using src.Helpers; using src.Helpers;
@ -8,6 +9,7 @@ namespace src.Wall
{ {
public class WallTransparency : GameplayComponent public class WallTransparency : GameplayComponent
{ {
public float secondsToWait = 0.1f;
private SpriteRenderer _spriteRenderer; private SpriteRenderer _spriteRenderer;
private Color _originalSpriteColor; private Color _originalSpriteColor;
private bool _isTransparent; private bool _isTransparent;
@ -16,9 +18,12 @@ namespace src.Wall
{ {
_spriteRenderer = GetComponentInChildren<SpriteRenderer>(); _spriteRenderer = GetComponentInChildren<SpriteRenderer>();
_originalSpriteColor = _spriteRenderer.color; _originalSpriteColor = _spriteRenderer.color;
StartCoroutine(CheckIfSomethingNear());
} }
private void Update() private IEnumerator CheckIfSomethingNear()
{
while (true)
{ {
var position = transform.position; var position = transform.position;
/* RayCast from the center of the tile up one distance and set layerMask to Player only! */ /* RayCast from the center of the tile up one distance and set layerMask to Player only! */
@ -32,6 +37,9 @@ namespace src.Wall
{ {
BecomeOpaque(); BecomeOpaque();
} }
yield return new WaitForSeconds(secondsToWait);
}
} }
private void ChangeSpriteAlpha(float alpha) private void ChangeSpriteAlpha(float alpha)

View file

@ -32,6 +32,9 @@ GraphicsSettings:
- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10783, 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_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0} type: 0}