This commit is contained in:
Sweet Tini
2020-01-31 23:39:39 -05:00
5 changed files with 16 additions and 47 deletions

View File

@@ -4,9 +4,10 @@ using UnityEngine;
public class BugMovement : MonoBehaviour
{
[SerializeField] private int secondsGoingLeft = 1;
[SerializeField] private int secondsGoingRight = 1;
[SerializeField] private float secondsGoingLeft = 1;
[SerializeField] private float secondsGoingRight = 1;
[SerializeField] private float movementSpeed = 10;
[SerializeField] PolygonCollider2D playerCollider;
private int leftAccumalator = 0;
private int rightAccumalator = 0;
@@ -16,8 +17,7 @@ public class BugMovement : MonoBehaviour
private void Start()
{
// Physics2D.IgnoreLayerCollision(LayerMask.GetMask())
Physics2D.IgnoreCollision(GetComponent<BoxCollider2D>(), playerCollider);
rigidBody = GetComponent<Rigidbody2D>();
}

View File

@@ -1317,10 +1317,15 @@ PrefabInstance:
propertyPath: m_BodyType
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3827363133515929334, guid: ef13d4cb4d0a2b043b4f2a6cc75ca48a,
type: 3}
propertyPath: m_GravityScale
value: 2
objectReference: {fileID: 0}
- target: {fileID: 3827363133515929335, guid: ef13d4cb4d0a2b043b4f2a6cc75ca48a,
type: 3}
propertyPath: movementSpeed
value: 1
value: 2
objectReference: {fileID: 0}
- target: {fileID: 3827363133515929335, guid: ef13d4cb4d0a2b043b4f2a6cc75ca48a,
type: 3}
@@ -1330,7 +1335,7 @@ PrefabInstance:
- target: {fileID: 3827363133515929335, guid: ef13d4cb4d0a2b043b4f2a6cc75ca48a,
type: 3}
propertyPath: secondsGoingRight
value: 2
value: 8
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: ef13d4cb4d0a2b043b4f2a6cc75ca48a, type: 3}

View File

@@ -4,5 +4,7 @@ using UnityEngine;
public static class LayerNames
{
public static string Enemies => "Enemies";
public static string Ground => "Ground";
public static string Player => "Player";
}

View File

@@ -9,8 +9,6 @@ public class Player : MonoBehaviour
[SerializeField] private float runFasterFactor = 1.5f;
private Rigidbody2D rigidbody;
private string enemiesLayerName => "Enemies";
private string groundLayerName => "Ground";
private void Start()
{
@@ -31,7 +29,7 @@ public class Player : MonoBehaviour
private void Jump()
{
var playerOnGround = rigidbody.IsTouchingLayers(LayerMask.GetMask(groundLayerName));
var playerOnGround = rigidbody.IsTouchingLayers(LayerMask.GetMask(LayerNames.Ground));
// Jump
if (Input.GetKey(KeyCode.Space) && playerOnGround)
@@ -65,6 +63,6 @@ public class Player : MonoBehaviour
private bool HasEncounteredEnemy()
{
return rigidbody.IsTouchingLayers(LayerMask.GetMask(enemiesLayerName));
return rigidbody.IsTouchingLayers(LayerMask.GetMask(LayerNames.Enemies));
}
}

View File

@@ -82,42 +82,6 @@ TextureImporter:
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048