Commit 07f85039 authored by Sebastian Woelfel's avatar Sebastian Woelfel

super

parent aeacf84c
......@@ -90,11 +90,11 @@ public class PlayerTileMovement : MonoBehaviour
playerNextToMetallicBox = false;
}
if (boxNextToPlayer != null)
{
playerNextToMetallicBox =
boxNextToPlayer && boxNextToPlayer.GetComponent<BoxType>().bType == BoxType.Boxtype.Stahl;
}
// if (boxNextToPlayer != null)
// {
// playerNextToMetallicBox =
// boxNextToPlayer && boxNextToPlayer.GetComponent<BoxType>().bType == BoxType.Boxtype.Stahl;
// }
}
private IEnumerator ActionCooldown(float cooldown)
......@@ -168,12 +168,17 @@ public class PlayerTileMovement : MonoBehaviour
}
}
if (playerNextToMetallicBox && onElectric)
if (onElectric)
{
bool boxLeftSteel = boxLeftToPlayer && boxLeftToPlayer.collider.GetComponent<BoxType>().bType == BoxType.Boxtype.Stahl;
bool boxRightSteel = boxRightToPlayer && boxRightToPlayer.collider.GetComponent<BoxType>().bType == BoxType.Boxtype.Stahl;
bool boxDownSteel = boxDownToPlayer && boxDownToPlayer.collider.GetComponent<BoxType>().bType == BoxType.Boxtype.Stahl;
bool boxUpSteel = boxUpToPlayer && boxUpToPlayer.collider.GetComponent<BoxType>().bType == BoxType.Boxtype.Stahl;
if (GetCell(wallMap,
new Vector2(transform.position.x, transform.position.y) + moveDir) == null)
{
if (boxLeftToPlayer && moveDir.x > 0)
if (boxLeftToPlayer && moveDir.x > 0 && boxLeftSteel)
{
if (boxRightToPlayer && GetCell(wallMap,
new Vector2(boxRightToPlayer.transform.position.x,
......@@ -193,7 +198,7 @@ public class PlayerTileMovement : MonoBehaviour
}
}
if (boxRightToPlayer && moveDir.x < 0)
if (boxRightToPlayer && moveDir.x < 0 && boxRightSteel)
{
if (boxLeftToPlayer && GetCell(wallMap,
new Vector2(boxLeftToPlayer.transform.position.x,
......@@ -213,7 +218,7 @@ public class PlayerTileMovement : MonoBehaviour
}
}
if (boxUpToPlayer && moveDir.y < 0)
if (boxUpToPlayer && moveDir.y < 0 && boxUpSteel)
{
if (boxDownToPlayer && GetCell(wallMap,
new Vector2(boxDownToPlayer.transform.position.x,
......@@ -233,7 +238,7 @@ public class PlayerTileMovement : MonoBehaviour
}
}
if (boxDownToPlayer && moveDir.y > 0)
if (boxDownToPlayer && moveDir.y > 0 && boxDownSteel)
{
if (boxUpToPlayer && GetCell(wallMap,
new Vector2(boxUpToPlayer.transform.position.x,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment