private void OnCollisionEnter(Collision other) { onStayTimer = 0; if (other.gameObject.CompareTag("Wall")) { random_rot = Random.Range(135f, 225f); cmp_rot.InstantRotation(0, random_rot, 0, Space.Self); } if (other.gameObject.CompareTag("Rhino")) { random_rot = Random.Range(135f, 225f); cmp_rot.InstantRotation(0, random_rot, 0, Space.Self); } if (other.gameObject.CompareTag("Boss")) { random_rot = Random.Range(135f, 225f); cmp_rot.InstantRotation(0, random_rot, 0, Space.Self); } if (other.gameObject.CompareTag("Player")) { if (GameObject.Find("Player").GetComponent <PlayerController>().inmune == false) { other.gameObject.GetComponent <PlayerController>().DamageItself(1); //Physics.IgnoreCollision(other.gameObject.GetComponent<Collider>(), gameObject.GetComponent<Collider>(), true); } //random_rot = Random.Range(135f, 225f); //cmp_rot.InstantRotation(0, random_rot, 0, Space.Self); } if (other.gameObject.CompareTag("Enemy")) { random_rot = Random.Range(135f, 225f); cmp_rot.InstantRotation(0, random_rot, 0, Space.Self); } }
private void OnCollisionEnter(Collision other) { if (other.gameObject.CompareTag("Wall")) { random_rot = Random.Range(135f, 225f); cmp_rot.InstantRotation(0, random_rot, 0, Space.Self); } if (other.gameObject.CompareTag("Rhino")) { random_rot = Random.Range(135f, 225f); cmp_rot.InstantRotation(0, random_rot, 0, Space.Self); } if (other.gameObject.CompareTag("Player")) { if (GameObject.Find("Player").GetComponent <PlayerController>().inmune == false) { other.gameObject.GetComponent <PlayerController>().DamageItself(1); } random_rot = Random.Range(135f, 225f); cmp_rot.InstantRotation(0, random_rot, 0, Space.Self); } if (other.gameObject.CompareTag("Enemy")) { random_rot = Random.Range(135f, 225f); cmp_rot.InstantRotation(0, random_rot, 0, Space.Self); } }
public void Proyectile() { timer += Time.deltaTime; if (timer >= time_to_up && to_down == false) { transform.position = new Vector3(GameObject.Find("Player").transform.position.x, transform.position.y, GameObject.Find("Player").transform.position.z); cmp_rot.InstantRotation(180, 0, 0, Space.World); cmp_mov.Move_in_Y(up_spd * 0.7f, -1); to_down = true; } else if (timer < time_to_up) { cmp_mov.Move_in_Y(up_spd, 1); } }
private void OnEnable() { to_down = false; timer = 0; cmp_rot.InstantRotation(180, 0, 0, Space.World); }