parent
1a71516e55
commit
6c146a9cbd
11 changed files with 81 additions and 39 deletions
@ -1,6 +0,0 @@ |
||||
using UnityEngine; |
||||
|
||||
// Graphical bonus to make ball going through it look cool |
||||
public class DeathGate : MonoBehaviour { |
||||
|
||||
} |
@ -0,0 +1,33 @@ |
||||
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(); |
||||
} |
||||
|
||||
} |
||||
} |
@ -1,9 +1,9 @@ |
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False"> |
||||
<Style src="project://database/Assets/UI%20Toolkit/styles.uss?fileID=7433441132597879392&guid=a6abab2f6d20ba823bad41d2081810e9&type=3#styles" /> |
||||
<Style src="project://database/Assets/UI%20Toolkit/player_panel.uss?fileID=7433441132597879392&guid=102b2cb1b84d8883abde9356b92d807e&type=3#player_panel" /> |
||||
<ui:Button text="Right" display-tooltip-when-elided="true" name="btn_right" /> |
||||
<ui:Button text="Left" display-tooltip-when-elided="true" name="btn_left" /> |
||||
<ui:VisualElement class="mods_list" /> |
||||
<ui:Label text="0" display-tooltip-when-elided="true" name="score" /> |
||||
<ui:Label display-tooltip-when-elided="true" name="score" binding-path="m_Score" /> |
||||
<ui:VisualElement class="mods_list" /> |
||||
<ui:Button text="Left" display-tooltip-when-elided="true" name="btn_left" /> |
||||
<ui:Button text="Right" display-tooltip-when-elided="true" name="btn_right" /> |
||||
</ui:UXML> |
||||
|
Loading…
Reference in new issue