Tap update

This commit is contained in:
NIMFER 2021-08-28 12:44:09 +02:00
parent c4e92f1ba2
commit 62f6073fad

View file

@ -30,6 +30,9 @@ public class Trap : MonoBehaviour
[Header("Trap settings")] [Header("Trap settings")]
public LayerMask player;
public LayerMask robber;
[Dropdown("trapTypes")] [Dropdown("trapTypes")]
public string trapType; public string trapType;
private string[] trapTypes = new string[] { "Pinns", "Rope", "Ladder", "Bear Trap", "Bannana Peal" }; private string[] trapTypes = new string[] { "Pinns", "Rope", "Ladder", "Bear Trap", "Bannana Peal" };
@ -103,20 +106,26 @@ public class Trap : MonoBehaviour
private void FixedUpdate() private void FixedUpdate()
{ {
if (Physics.CheckSphere(transform.position + trapInteractionRadiusOffset, trapInteractionRadius)) if (Physics.CheckSphere(transform.position + trapInteractionRadiusOffset, trapInteractionRadius, player))
{ {
switch (interacted) playerInRange = true;
{
case 1: }
Debug.Log("trap collected"); else
isSet = false; {
GetComponent<MeshRenderer>().sharedMaterial = setMaterial; playerInRange = false;
break; }
case 0:
//Debug.Log("player in range"); if (Physics.CheckSphere(transform.position + trapInteractionRadiusOffset, trapInteractionRadius, player))
break; {
}
playerInRange = true;
}
else
{
playerInRange = false;
} }
} }
@ -127,7 +136,17 @@ public class Trap : MonoBehaviour
if (playerInRange) if (playerInRange)
{ {
switch (interacted)
{
case 1:
Debug.Log("trap collected");
isSet = false;
GetComponent<MeshRenderer>().sharedMaterial = setMaterial;
break;
case 0:
//Debug.Log("player in range");
break;
}
} }
if (robberInRange) if (robberInRange)