Added files
This commit is contained in:
@@ -184,3 +184,4 @@ MonoBehaviour:
|
|||||||
targetRefreshInterval: 0.4
|
targetRefreshInterval: 0.4
|
||||||
consumeDistance: 0.35
|
consumeDistance: 0.35
|
||||||
wanderInterval: 1.2
|
wanderInterval: 1.2
|
||||||
|
trickPrefab: {fileID: 700000000, guid: 8bf8957665594a718535d06aba0cdee7, type: 3}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -10,6 +10,7 @@ public class TrickController : MonoBehaviour
|
|||||||
[SerializeField] private float targetRefreshInterval = 0.4f;
|
[SerializeField] private float targetRefreshInterval = 0.4f;
|
||||||
[SerializeField] private float consumeDistance = 0.35f;
|
[SerializeField] private float consumeDistance = 0.35f;
|
||||||
[SerializeField] private float wanderInterval = 1.2f;
|
[SerializeField] private float wanderInterval = 1.2f;
|
||||||
|
[SerializeField] private TrickController trickPrefab;
|
||||||
|
|
||||||
private Rigidbody2D body;
|
private Rigidbody2D body;
|
||||||
private Transform target;
|
private Transform target;
|
||||||
@@ -144,15 +145,28 @@ public class TrickController : MonoBehaviour
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var spawnPosition = hit.transform.position;
|
||||||
Destroy(hit.gameObject);
|
Destroy(hit.gameObject);
|
||||||
if (target == hit.transform)
|
if (target == hit.transform)
|
||||||
{
|
{
|
||||||
target = null;
|
target = null;
|
||||||
}
|
}
|
||||||
|
SpawnTrick(spawnPosition);
|
||||||
break;
|
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)
|
public void SetCarried(bool carried)
|
||||||
{
|
{
|
||||||
isCarried = carried;
|
isCarried = carried;
|
||||||
|
|||||||
Reference in New Issue
Block a user