This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = { | |
method: "POST", | |
headers: { | |
"Content-Type": "application/json", | |
"Authorization": "Bearer " + config.chatGpt.secret | |
}, | |
body: JSON.stringify({ | |
model: "gpt-3.5-turbo", | |
messages: [{ | |
role: "user", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void CreateMines() | |
{ | |
while (mineCount > 0) | |
{ | |
int index = Random.Range(0, base.transform.childCount); | |
GameObject gameObject = base.transform.GetChild(index).gameObject; | |
if (gameObject != null) | |
{ | |
if (!gameObject.GetComponent<MinePlate>().isMine) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hits = Physics.RaycastAll(_lastPos, Vector3.Normalize(transform.position - _lastPos), Vector3.Distance(_lastPos, transform.position)); | |
_lastPos = transform.position; | |
for (int i = 0; i < hits.Length; i++) | |
{ | |
if (hits[i].transform.tag == "Ground" && rb.velocity.y < 0) | |
{ | |
this.transform.position = hits[i].point; | |
JumpLand.Play(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Physics.Raycast(transform.position, transform.forward, out hit)) | |
{ | |
if (hit.collider) | |
{ | |
lr.SetPosition(1, new Vector3(0,0,hit.distance)); | |
} | |
} | |
else | |
lr.SetPosition(1, new Vector3(0,0,10)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Apply force - More up assist depending on y position | |
var assistPoint = Mathf.InverseLerp(0, _maxY, _rb.position.y); | |
var assistAmount = Mathf.Lerp(_maxUpAssist, 0, assistPoint); | |
var forceDir = -transform.forward * _forceAmount + Vector3.up * assistAmount; | |
if (_rb.position.y > _maxY) forceDir.y = Mathf.Min(0, forceDir.y); | |
_rb.AddForce(forceDir); | |
// Determine the additional torque to apply when swapping direction | |
var angularPoint = Mathf.InverseLerp(0, _maxAngularVelocity, Mathf.Abs(_rb.angularVelocity.z)); | |
var amount = Mathf.Lerp(0, _maxTorqueBonus, angularPoint); |