Merge branch 'master' of https://github.com/Birb-Games-Studio/Robber-and-Dobber
This commit is contained in:
commit
7d24fb961c
1 changed files with 32 additions and 13 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue