Keep local version of files
This commit is contained in:
+57
-57
@@ -1,57 +1,57 @@
|
||||
using Mirror;
|
||||
using UnityEngine;
|
||||
|
||||
public class Goal : NetworkBehaviour
|
||||
{
|
||||
public Team team;
|
||||
|
||||
public static Goal RedGoal,BlueGoal;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if(team == Team.Red){
|
||||
RedGoal = this;
|
||||
}else{
|
||||
BlueGoal = this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
if(!isServer){return;}
|
||||
if(GameManager.instance != null && GameManager.instance.AreResetCollisionsDisabled)
|
||||
return;
|
||||
|
||||
if(collision.gameObject.CompareTag("Player")){
|
||||
if(GameManager.instance == null || !GameManager.instance.CanProcessGoal){
|
||||
return;
|
||||
}
|
||||
Debug.Log($"GOAL! {team}", gameObject);
|
||||
Ball ball = collision.gameObject.GetComponent<Ball>();
|
||||
Debug.Log(ball.name);
|
||||
GameManager.instance.OnGoal(team);
|
||||
}else if(collision.gameObject.CompareTag("Puck")){
|
||||
if(GameManager.instance == null || !GameManager.instance.CanProcessGoal)
|
||||
return;
|
||||
Debug.Log("Puck goal", gameObject);
|
||||
Puck puck = collision.gameObject.GetComponent<Puck>();
|
||||
Debug.Log(puck.name);
|
||||
puck.ScheduleReset(collision.transform.position);
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerExit2D(Collider2D collision)
|
||||
{
|
||||
if(!isServer){return;}
|
||||
|
||||
if(collision.gameObject.CompareTag("Puck")){
|
||||
if(GameManager.instance != null && GameManager.instance.AreResetCollisionsDisabled)
|
||||
return;
|
||||
Debug.Log("Puck exit goal", gameObject);
|
||||
Puck puck = collision.gameObject.GetComponent<Puck>();
|
||||
Debug.Log(puck.name);
|
||||
puck.UnscheduleReset();
|
||||
}
|
||||
}
|
||||
}
|
||||
using Mirror;
|
||||
using UnityEngine;
|
||||
|
||||
public class Goal : NetworkBehaviour
|
||||
{
|
||||
public Team team;
|
||||
|
||||
public static Goal RedGoal,BlueGoal;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if(team == Team.Red){
|
||||
RedGoal = this;
|
||||
}else{
|
||||
BlueGoal = this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
if(!isServer){return;}
|
||||
if(GameManager.instance != null && GameManager.instance.AreResetCollisionsDisabled)
|
||||
return;
|
||||
|
||||
if(collision.gameObject.CompareTag("Player")){
|
||||
if(GameManager.instance == null || !GameManager.instance.CanProcessGoal){
|
||||
return;
|
||||
}
|
||||
Debug.Log($"GOAL! {team}", gameObject);
|
||||
Ball ball = collision.gameObject.GetComponent<Ball>();
|
||||
Debug.Log(ball.name);
|
||||
GameManager.instance.OnGoal(team);
|
||||
}else if(collision.gameObject.CompareTag("Puck")){
|
||||
if(GameManager.instance == null || !GameManager.instance.CanProcessGoal)
|
||||
return;
|
||||
Debug.Log("Puck goal", gameObject);
|
||||
Puck puck = collision.gameObject.GetComponent<Puck>();
|
||||
Debug.Log(puck.name);
|
||||
puck.ScheduleReset(collision.transform.position);
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerExit2D(Collider2D collision)
|
||||
{
|
||||
if(!isServer){return;}
|
||||
|
||||
if(collision.gameObject.CompareTag("Puck")){
|
||||
if(GameManager.instance != null && GameManager.instance.AreResetCollisionsDisabled)
|
||||
return;
|
||||
Debug.Log("Puck exit goal", gameObject);
|
||||
Puck puck = collision.gameObject.GetComponent<Puck>();
|
||||
Debug.Log(puck.name);
|
||||
puck.UnscheduleReset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user