50 lines
1.0 KiB
C#
50 lines
1.0 KiB
C#
using UnityEngine;
|
|
|
|
public class LogicBreakableRopes : MonoBehaviour
|
|
{
|
|
public UltimateRope Rope1;
|
|
|
|
public UltimateRope Rope2;
|
|
|
|
private bool bBroken1;
|
|
|
|
private bool bBroken2;
|
|
|
|
private void Start()
|
|
{
|
|
bBroken1 = false;
|
|
bBroken2 = false;
|
|
}
|
|
|
|
private void OnGUI()
|
|
{
|
|
LogicGlobal.GlobalGUI();
|
|
GUILayout.Label("Breakable rope test (procedural rope and linkedobjects rope with breakable properties and notifications set)");
|
|
GUILayout.Label("Move the mouse while holding down the left button to move the camera");
|
|
GUILayout.Label("Use the spacebar to shoot balls and aim for the ropes to break them");
|
|
Color color = GUI.color;
|
|
GUI.color = new Color(255f, 0f, 0f);
|
|
if (bBroken1)
|
|
{
|
|
GUILayout.Label("Rope 1 was broken");
|
|
}
|
|
if (bBroken2)
|
|
{
|
|
GUILayout.Label("Rope 2 was broken");
|
|
}
|
|
GUI.color = color;
|
|
}
|
|
|
|
private void OnRopeBreak(UltimateRope.RopeBreakEventInfo breakInfo)
|
|
{
|
|
if (breakInfo.rope == Rope1)
|
|
{
|
|
bBroken1 = true;
|
|
}
|
|
if (breakInfo.rope == Rope2)
|
|
{
|
|
bBroken2 = true;
|
|
}
|
|
}
|
|
}
|