You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
628 B
34 lines
628 B
2 years ago
|
using System;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace Game {
|
||
|
public class DeathGate : MonoBehaviour {
|
||
|
|
||
|
public Side side;
|
||
|
|
||
|
private Player thisPlayer, otherPlayer;
|
||
|
|
||
|
private void Start() {
|
||
|
Player p1 = GameManager.Singleton.Player1;
|
||
|
Player p2 = GameManager.Singleton.Player2;
|
||
|
if (p1.Side == side) {
|
||
|
thisPlayer = p1;
|
||
|
otherPlayer = p2;
|
||
|
} else {
|
||
|
thisPlayer = p2;
|
||
|
otherPlayer = p1;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void OnTriggerEnter2D(Collider2D other) {
|
||
|
otherPlayer.GainScore();
|
||
|
|
||
|
Ball ball = other.GetComponent<Ball>();
|
||
|
GameManager.Singleton.RemoveBall(ball);
|
||
|
|
||
|
GameManager.Singleton.SpawnBall();
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|