Merge pull request 'get-tricky' (#28) from get-tricky into main
Reviewed-on: admin/GGJ2026#28 Reviewed-by: Ramdar <[email protected]>
This commit is contained in:
@@ -184,3 +184,4 @@ MonoBehaviour:
|
||||
targetRefreshInterval: 0.4
|
||||
consumeDistance: 0.35
|
||||
wanderInterval: 1.2
|
||||
trickPrefab: {fileID: 700000000, guid: 8bf8957665594a718535d06aba0cdee7, type: 3}
|
||||
|
||||
@@ -10,6 +10,7 @@ public class TrickController : MonoBehaviour
|
||||
[SerializeField] private float targetRefreshInterval = 0.4f;
|
||||
[SerializeField] private float consumeDistance = 0.35f;
|
||||
[SerializeField] private float wanderInterval = 1.2f;
|
||||
[SerializeField] private TrickController trickPrefab;
|
||||
|
||||
private Rigidbody2D body;
|
||||
private Transform target;
|
||||
@@ -144,15 +145,28 @@ public class TrickController : MonoBehaviour
|
||||
continue;
|
||||
}
|
||||
|
||||
var spawnPosition = hit.transform.position;
|
||||
Destroy(hit.gameObject);
|
||||
if (target == hit.transform)
|
||||
{
|
||||
target = null;
|
||||
}
|
||||
SpawnTrick(spawnPosition);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void SpawnTrick(Vector3 position)
|
||||
{
|
||||
if (trickPrefab != null)
|
||||
{
|
||||
Instantiate(trickPrefab, position, Quaternion.identity);
|
||||
return;
|
||||
}
|
||||
|
||||
Instantiate(gameObject, position, Quaternion.identity);
|
||||
}
|
||||
|
||||
public void SetCarried(bool carried)
|
||||
{
|
||||
isCarried = carried;
|
||||
|
||||
Reference in New Issue
Block a user