Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
test
///// DEFUALT FUNCTIONS ^ void Awake() { refrence = GameObject.FindWithTag("Game Controller").GetComponent<gameController>(); bc.enabled = false; } void Update() { if (alive) { lastVelocity = rb.velocity; checkForBlock(); } } void FixedUpdate() { if (!charging) { transform.Rotate(0, 0, rotationDirection * rotationSpeed * Time.fixedDeltaTime); speed = (transform.position - lastPosition).magnitude; if (speed==0) rb.velocity = moveDirection.normalized * moveSpeed; lastPosition = transform.position; } } #endregion void OnCollisionEnter2D (Collision2D col) { if (alive){ bool collided = true; if (col.gameObject.CompareTag("Player")) { col.gameObject.GetComponent<coreController>().damageCheck(); if (col.gameObject.GetComponent<coreController>().recovering == true) collided = false; } if (collided && !recentlySpawned && !charging) rebounce(col); rb.velocity = moveDirection.normalized * moveSpeed; } if (!col.gameObject.CompareTag("Obstacle")) { aS.clip = bounceSFX; aS.Play(); } } void rebounce(Collision2D col) { if (rebounceExtraSpeed>0) moveSpeed += rebounceExtraSpeed; moveDirection = Vector3.Reflect(lastVelocity.normalized, col.contacts[0].normal); if (transform.rotation.z >= 0.6f) rotationDirection = 1f; else if (transform.rotation.z <= -0.6f) rotationDirection = -1f; if (moveDirection.x == 0) moveDirection = new Vector2(0.3f, moveDirection.y); if (moveDirection.y == 0) moveDirection = new Vector2(moveDirection.x, 0.3f); } void checkForBlock() { if (bc.enabled == false) { blocked = Physics2D.Raycast((new Vector2(rb.position.x, rb.position.y)), Vector2.down, 0.1f, LayerMask.GetMask("Terrain")); } } public IEnumerator debugSpawn() { charging = true; yield return new WaitForSeconds(1.1f); charging = false; rb.velocity = moveDirection.normalized * moveSpeed; yield return new WaitUntil(() => blocked == false); yield return new WaitForSeconds(0.15f); bc.enabled = true; yield return new WaitForSeconds(0.35f); recentlySpawned = false; } }
run
|
edit
|
history
|
help
0
Convert String to Pig Latin
Plt-D v.0.8
Area and Parameter of Circle
Prac1_A
fracOp
stars
Add char to non-numerical words only
Fórum ➡ Get all combinations for ▶different◀ Id's ♦
Rijndael AES key generator C#
Fortnite Generator