progress
This commit is contained in:
@@ -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>();
|
||||
}
|
||||
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ TextureImporter:
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spritePixelsToUnits: 16
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
@@ -70,6 +70,30 @@ TextureImporter:
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
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
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
|
||||
Reference in New Issue
Block a user