finally fixed player getting stuck
This commit is contained in:
@@ -48168,8 +48168,8 @@ Rigidbody2D:
|
|||||||
m_SleepingMode: 1
|
m_SleepingMode: 1
|
||||||
m_CollisionDetection: 1
|
m_CollisionDetection: 1
|
||||||
m_Constraints: 4
|
m_Constraints: 4
|
||||||
--- !u!61 &1671840919
|
--- !u!70 &1671840919
|
||||||
BoxCollider2D:
|
CapsuleCollider2D:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
@@ -48181,19 +48181,9 @@ BoxCollider2D:
|
|||||||
m_IsTrigger: 0
|
m_IsTrigger: 0
|
||||||
m_UsedByEffector: 0
|
m_UsedByEffector: 0
|
||||||
m_UsedByComposite: 0
|
m_UsedByComposite: 0
|
||||||
m_Offset: {x: -0.01, y: -0.62}
|
m_Offset: {x: 0, y: -0.64}
|
||||||
m_SpriteTilingProperty:
|
m_Size: {x: 0.9, y: 2.75}
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
m_Direction: 0
|
||||||
pivot: {x: 0.5, y: 0.5}
|
|
||||||
oldSize: {x: 4, y: 4}
|
|
||||||
newSize: {x: 1, y: 1}
|
|
||||||
adaptiveTilingThreshold: 0.5
|
|
||||||
drawMode: 0
|
|
||||||
adaptiveTiling: 0
|
|
||||||
m_AutoTiling: 1
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Size: {x: 0.9, y: 2.79}
|
|
||||||
m_EdgeRadius: 0
|
|
||||||
--- !u!212 &1671840920
|
--- !u!212 &1671840920
|
||||||
SpriteRenderer:
|
SpriteRenderer:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public class BugMovement : MonoBehaviour
|
|||||||
[SerializeField] private float secondsGoingLeft = 1;
|
[SerializeField] private float secondsGoingLeft = 1;
|
||||||
[SerializeField] private float secondsGoingRight = 1;
|
[SerializeField] private float secondsGoingRight = 1;
|
||||||
[SerializeField] private float movementSpeed = 10;
|
[SerializeField] private float movementSpeed = 10;
|
||||||
[SerializeField] BoxCollider2D playerCollider;
|
[SerializeField] Collider2D playerCollider;
|
||||||
[SerializeField] EventControls eventControls;
|
[SerializeField] EventControls eventControls;
|
||||||
[SerializeField] Player player;
|
[SerializeField] Player player;
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ public class BugMovement : MonoBehaviour
|
|||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
if (HasEncounteredPlayer())
|
if (HasEncounteredPlayer())
|
||||||
eventControls.TriggerEvent(playerCollider, GetComponent<BoxCollider2D>(), player);
|
eventControls.TriggerEvent(playerCollider, GetComponent<Collider2D>(), player);
|
||||||
|
|
||||||
var totalFramesGoingLeft = framesPerSecond * secondsGoingLeft;
|
var totalFramesGoingLeft = framesPerSecond * secondsGoingLeft;
|
||||||
var totalFramesGoingRight = framesPerSecond * secondsGoingRight;
|
var totalFramesGoingRight = framesPerSecond * secondsGoingRight;
|
||||||
|
|||||||
@@ -27,14 +27,14 @@ public class Player : MonoBehaviour
|
|||||||
|
|
||||||
|
|
||||||
private Rigidbody2D rigidBody;
|
private Rigidbody2D rigidBody;
|
||||||
new private BoxCollider2D collider;
|
new private Collider2D collider;
|
||||||
private Animator animator;
|
private Animator animator;
|
||||||
private bool isMovementEnabled = true;
|
private bool isMovementEnabled = true;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
rigidBody = GetComponent<Rigidbody2D>();
|
rigidBody = GetComponent<Rigidbody2D>();
|
||||||
collider = GetComponent<BoxCollider2D>();
|
collider = GetComponent<Collider2D>();
|
||||||
animator = GetComponent<Animator>();
|
animator = GetComponent<Animator>();
|
||||||
currentHealth = startHealth;
|
currentHealth = startHealth;
|
||||||
currentStamina = startStamina;
|
currentStamina = startStamina;
|
||||||
@@ -173,10 +173,10 @@ public class Player : MonoBehaviour
|
|||||||
|
|
||||||
private bool IsPlayerOnWall(bool ignoreGround = false)
|
private bool IsPlayerOnWall(bool ignoreGround = false)
|
||||||
{
|
{
|
||||||
return IsPointOnWall(transform.position + new Vector3(0, collider.bounds.extents.y * 0.6f, 0), ignoreGround) ||
|
return IsPointOnWall(transform.position + new Vector3(0, collider.bounds.extents.y * 0.52f, 0), ignoreGround) ||
|
||||||
IsPointOnWall(transform.position - new Vector3(0, collider.bounds.extents.y * 0.25f, 0), ignoreGround) ||
|
IsPointOnWall(transform.position - new Vector3(0, collider.bounds.extents.y * 0.24f, 0), ignoreGround) ||
|
||||||
IsPointOnWall(transform.position - new Vector3(0, collider.bounds.extents.y * 0.8f, 0), ignoreGround) ||
|
IsPointOnWall(transform.position - new Vector3(0, collider.bounds.extents.y * 0.8f, 0), ignoreGround) ||
|
||||||
IsPointOnWall(transform.position - new Vector3(0, collider.bounds.extents.y * 1.5f, 0), ignoreGround);
|
IsPointOnWall(transform.position - new Vector3(0, collider.bounds.extents.y * 1.45f, 0), ignoreGround);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsPointOnWall(Vector2 position, bool ignoreGround = false)
|
private bool IsPointOnWall(Vector2 position, bool ignoreGround = false)
|
||||||
|
|||||||
8
Assets/Sprites/Controls.meta
Normal file
8
Assets/Sprites/Controls.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bf9fc495ca38d7d4d804ad1d2df0f4c5
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: bf9fc495ca38d7d4d804ad1d2df0f4c5
|
guid: 93ff3d1c20b08c048a2ae60a4b35e73f
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|||||||
Reference in New Issue
Block a user