Commit d3a0e8a2 authored by Valentin Schneider's avatar Valentin Schneider

BOOOOOOOOB DER BAUZMEISTER LOS WIR BUILDEN

parent 266a91ff
......@@ -14,6 +14,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
DeveloperDescription:
value: 5
oldValue: 1
oldValue: 3
Changed: {fileID: 11400000, guid: 0bc274d384804274295aea259eb82381, type: 2}
ChangedWithHistory: {fileID: 0}
......@@ -14,6 +14,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
DeveloperDescription:
value: 5
oldValue: 1
oldValue: 0
Changed: {fileID: 11400000, guid: 0bc274d384804274295aea259eb82381, type: 2}
ChangedWithHistory: {fileID: 0}
......@@ -11,8 +11,8 @@ GameObject:
- component: {fileID: 7107667617463359943}
- component: {fileID: 5283327783176090585}
m_Layer: 0
m_Name: SpawnPositionManager
m_TagString: Untagged
m_Name: StageManager
m_TagString: StageManager
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
......@@ -43,3 +43,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c3e68dcf2b464ed45ae1880c684317f3, type: 3}
m_Name:
m_EditorClassIdentifier:
player1Spawn: {x: 0, y: 0, z: 0}
player2Spawn: {x: 0, y: 0, z: 0}
ballSpawn: {x: 0, y: 0, z: 0}
player1Reset: {x: 0, y: 0, z: 0}
player2Reset: {x: 0, y: 0, z: 0}
ballReset: {x: 0, y: 0, z: 0}
playerScale: 0
ballScale: 0
currentStage: {fileID: 0}
......@@ -977,7 +977,7 @@ PrefabInstance:
- target: {fileID: 5361797920381783330, guid: e9ad53d2f00a7c5499747868b7933a59,
type: 3}
propertyPath: m_LocalPosition.y
value: -3.41
value: -1.88
objectReference: {fileID: 0}
- target: {fileID: 5361797920381783330, guid: e9ad53d2f00a7c5499747868b7933a59,
type: 3}
......
......@@ -1996,6 +1996,11 @@ PrefabInstance:
propertyPath: m_Name
value: StageManager
objectReference: {fileID: 0}
- target: {fileID: 6950031350484378512, guid: 717eddddb1a441d4e992ea34ff8d1e80,
type: 3}
propertyPath: m_TagString
value: StageManager
objectReference: {fileID: 0}
- target: {fileID: 7107667617463359943, guid: 717eddddb1a441d4e992ea34ff8d1e80,
type: 3}
propertyPath: m_LocalPosition.x
......
......@@ -3049,6 +3049,11 @@ PrefabInstance:
propertyPath: m_Name
value: StageManager
objectReference: {fileID: 0}
- target: {fileID: 6950031350484378512, guid: 717eddddb1a441d4e992ea34ff8d1e80,
type: 3}
propertyPath: m_TagString
value: StageManager
objectReference: {fileID: 0}
- target: {fileID: 7107667617463359943, guid: 717eddddb1a441d4e992ea34ff8d1e80,
type: 3}
propertyPath: m_LocalPosition.x
......
......@@ -26,7 +26,7 @@ public class GroundCollision : MonoBehaviour
if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Ball")))
{
resetting.Value = true;
resetter.ResetObjects();
if (activePlayer.value == 0)
{
player0.GetComponent<PlayerHealth>().TakeDamage();
......@@ -35,6 +35,7 @@ public class GroundCollision : MonoBehaviour
{
player1.GetComponent<PlayerHealth>().TakeDamage();
}
resetter.ResetObjects();
}
}
}
......@@ -14,13 +14,13 @@ public class PlayerReset : MonoBehaviour, IResettable
private PlayerMovement movement;
private Collider[] playerColliders;
private Collider2D[] playerColliders;
// Start is called before the first frame update
void Awake()
{
movement = GetComponent<PlayerMovement>();
playerColliders = GetComponents<Collider>();
playerColliders = GetComponents<Collider2D>();
}
private void Start()
......@@ -40,34 +40,48 @@ public class PlayerReset : MonoBehaviour, IResettable
public void ResetPosition()
{
movement.enabled = false;
foreach (Collider2D c in playerColliders)
{
c.enabled = false;
}
GetComponent<Rigidbody2D>().velocity = Vector2.zero;
GetComponent<Rigidbody2D>().isKinematic = true;
GetComponent<Rigidbody2D>().simulated = false;
//StartCoroutine(ResetPosition());
Sequence p = DOTween.Sequence().AppendInterval(1);
p.Append(transform.DOMove(spawnPosition, 1));
p.Append(transform.DOMove(spawnPosition, 2f));
p.onComplete += () =>
{
GetComponent<PlayerInputProvider>().JumpIsPressed = false;
movement.enabled = true;
GetComponent<Rigidbody2D>().isKinematic = false;
GetComponent<Rigidbody2D>().simulated = true;
foreach (Collider2D c in playerColliders)
{
c.enabled = true;
}
};
}
private void Update()
/*private void Update()
{
if (resetting.Value)
{
foreach (Collider c in playerColliders)
GetComponent<Rigidbody2D>().isKinematic = true;
foreach (Collider2D c in playerColliders)
{
c.enabled = false;
}
}
else
{
foreach (Collider c in playerColliders)
GetComponent<Rigidbody2D>().isKinematic = false;
foreach (Collider2D c in playerColliders)
{
c.enabled = true;
}
}
}
}*/
public Vector3 SpawnPosition
{
......
......@@ -20,7 +20,7 @@ public class PlayerSpawner : MonoBehaviour, ISpawnable
public void FindStageManager()
{
info = GameObject.Find("StageManager").GetComponent<StageManagement>();
info = GameObject.FindWithTag("StageManager").GetComponent<StageManagement>();
}
......@@ -33,6 +33,8 @@ public class PlayerSpawner : MonoBehaviour, ISpawnable
//---------TEMPORARY----------------------
transform.position = spawnPosition;
animator.PlaySpawnAnimation();
GetComponent<Rigidbody2D>().velocity = Vector2.zero;
//GetComponent<PlayerReset>().ResetPosition();
return;
//---------TEMPORARY----------------------
......
......@@ -9,6 +9,7 @@ TagManager:
- Spawnable
- GlobalLight
- SceneTransition
- StageManager
layers:
- Default
- TransparentFX
......
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