// Update is called once per frame void Update() { transform.position = GameObject.FindGameObjectWithTag("Player").transform.position; if (Input.GetAxis("Vertical") == 1) //Aiming UP { transform.rotation = Quaternion.Euler(0f, 0f, 90f); fireAngle = FireAngle2D.UP; //Debug.Log("UP"); } if (Input.GetAxis("Vertical") == -1) //Aiming UP { transform.rotation = Quaternion.Euler(0f, 0f, 270f); fireAngle = FireAngle2D.DOWN; //Debug.Log("UP"); } else if ((Input.GetAxis("Vertical") < -0.5 && Input.GetAxis("Vertical") > -1) && Input.GetAxis("Horizontal") > 0) //Aiming RIGHT { transform.rotation = Quaternion.Euler(0f, 0f, -67.5f); fireAngle = FireAngle2D.DDD_RIGHT; //Debug.Log("RIGHT"); } else if ((Input.GetAxis("Vertical") < -0.25 && Input.GetAxis("Vertical") >= -0.50) && Input.GetAxis("Horizontal") > 0) //Aiming RIGHT { transform.rotation = Quaternion.Euler(0f, 0f, -45f); fireAngle = FireAngle2D.DD_RIGHT; //Debug.Log("RIGHT"); } else if ((Input.GetAxis("Vertical") < 0 && Input.GetAxis("Vertical") >= -0.25) && Input.GetAxis("Horizontal") > 0) //Aiming RIGHT { transform.rotation = Quaternion.Euler(0f, 0f, -22.5f); fireAngle = FireAngle2D.D_RIGHT; //Debug.Log("RIGHT"); } else if (Input.GetAxis("Vertical") == 0 && Input.GetAxis("Horizontal") > 0) //Aiming RIGHT { transform.rotation = Quaternion.Euler(0f, 0f, 0f); fireAngle = FireAngle2D.RIGHT; //Debug.Log("RIGHT"); } else if ((Input.GetAxis("Vertical") >= 0 && Input.GetAxis("Vertical") <= 0.25) && Input.GetAxis("Horizontal") > 0) //Aiming UP RIGHT { transform.rotation = Quaternion.Euler(0f, 0f, 22.5f); fireAngle = FireAngle2D.U_RIGHT; //Debug.Log("U_RIGHT"); } else if ((Input.GetAxis("Vertical") > 0.25 && Input.GetAxis("Vertical") <= 0.50) && Input.GetAxis("Horizontal") > 0) //Aiming UP RIGHT { transform.rotation = Quaternion.Euler(0f, 0f, 45f); fireAngle = FireAngle2D.UU_RIGHT; //Debug.Log("U_RIGHT"); } else if ((Input.GetAxis("Vertical") > 0.50 && Input.GetAxis("Vertical") < 1) && Input.GetAxis("Horizontal") > 0) //Aiming UP RIGHT { transform.rotation = Quaternion.Euler(0f, 0f, 67.5f); fireAngle = FireAngle2D.UUU_RIGHT; //Debug.Log("U_RIGHT"); } else if ((Input.GetAxis("Vertical") < -0.5 && Input.GetAxis("Vertical") > -1) && Input.GetAxis("Horizontal") < 0) //Aiming RIGHT { transform.rotation = Quaternion.Euler(0f, 0f, 247.5f); fireAngle = FireAngle2D.DDD_LEFT; //Debug.Log("RIGHT"); } else if ((Input.GetAxis("Vertical") < -0.25 && Input.GetAxis("Vertical") >= -0.50) && Input.GetAxis("Horizontal") < 0) //Aiming RIGHT { transform.rotation = Quaternion.Euler(0f, 0f, 225f); fireAngle = FireAngle2D.DD_LEFT; //Debug.Log("RIGHT"); } else if ((Input.GetAxis("Vertical") < 0 && Input.GetAxis("Vertical") >= -0.25) && Input.GetAxis("Horizontal") < 0) //Aiming RIGHT { transform.rotation = Quaternion.Euler(0f, 0f, 202.5f); fireAngle = FireAngle2D.D_LEFT; //Debug.Log("RIGHT"); } else if (Input.GetAxis("Vertical") == 0 && Input.GetAxis("Horizontal") < 0) //Aiming LEFT { transform.rotation = Quaternion.Euler(0f, 0f, 180f); fireAngle = FireAngle2D.LEFT; //Debug.Log("LEFT"); } else if ((Input.GetAxis("Vertical") >= 0 && Input.GetAxis("Vertical") <= 0.25) && Input.GetAxis("Horizontal") < 0) //Aiming UP RIGHT { transform.rotation = Quaternion.Euler(0f, 0f, 157.5f); fireAngle = FireAngle2D.U_LEFT; //Debug.Log("U_RIGHT"); } else if ((Input.GetAxis("Vertical") > 0.25 && Input.GetAxis("Vertical") <= 0.50) && Input.GetAxis("Horizontal") < 0) //Aiming UP RIGHT { transform.rotation = Quaternion.Euler(0f, 0f, 135f); fireAngle = FireAngle2D.UU_LEFT; //Debug.Log("U_RIGHT"); } else if ((Input.GetAxis("Vertical") > 0.50 && Input.GetAxis("Vertical") < 1) && Input.GetAxis("Horizontal") < 0) //Aiming UP RIGHT { transform.rotation = Quaternion.Euler(0f, 0f, 112.5f); fireAngle = FireAngle2D.UUU_LEFT; //Debug.Log("U_RIGHT"); } }
void ShootMulti() { myAngle = GunController2D.fireAngle; if (myAngle == FireAngle2D.UP) { setRotation(95f); Effect(); setRotation(85f); Effect(); setRotation(90f); Effect(); } else if (myAngle == FireAngle2D.DOWN) { setRotation(275f); Effect(); setRotation(265f); Effect(); setRotation(270f); Effect(); } else if (myAngle == FireAngle2D.DDD_RIGHT) //Aiming UP RIGHT { setRotation(-72.5f); Effect(); setRotation(-62.5f); Effect(); setRotation(-67.5f); Effect(); } else if (myAngle == FireAngle2D.DD_RIGHT) //Aiming UP RIGHT { setRotation(-50f); Effect(); setRotation(-40f); Effect(); setRotation(-45f); Effect(); } else if (myAngle == FireAngle2D.D_RIGHT) //Aiming UP RIGHT { setRotation(-17.5f); Effect(); setRotation(-27.5f); Effect(); setRotation(-22.5f); Effect(); } else if (myAngle == FireAngle2D.RIGHT) //Aiming RIGHT { setRotation(5f); Effect(); setRotation(-5f); Effect(); setRotation(0f); Effect(); } else if (myAngle == FireAngle2D.U_RIGHT) //Aiming UP RIGHT { setRotation(17.5f); Effect(); setRotation(27.5f); Effect(); setRotation(22.5f); Effect(); } else if (myAngle == FireAngle2D.UU_RIGHT) //Aiming UP RIGHT { setRotation(50f); Effect(); setRotation(40f); Effect(); setRotation(45f); Effect(); } else if (myAngle == FireAngle2D.UUU_RIGHT) //Aiming UP RIGHT { setRotation(72.5f); Effect(); setRotation(62.5f); Effect(); setRotation(67.5f); Effect(); } else if (myAngle == FireAngle2D.DDD_LEFT) //Aiming LEFT { setRotation(252.5f); Effect(); setRotation(242.5f); Effect(); setRotation(247.5f); Effect(); } else if (myAngle == FireAngle2D.DD_LEFT) //Aiming LEFT { setRotation(230f); Effect(); setRotation(220f); Effect(); setRotation(225f); Effect(); } else if (myAngle == FireAngle2D.D_LEFT) //Aiming LEFT { setRotation(207.5f); Effect(); setRotation(197.5f); Effect(); setRotation(202.5f); Effect(); } else if (myAngle == FireAngle2D.LEFT) //Aiming LEFT { setRotation(185f); Effect(); setRotation(175f); Effect(); setRotation(180f); Effect(); } else if (myAngle == FireAngle2D.U_LEFT) //Aimin UP LEFT { setRotation(162.5f); Effect(); setRotation(152.5f); Effect(); setRotation(157.5f); Effect(); } else if (myAngle == FireAngle2D.UU_LEFT) //Aimin UP LEFT { setRotation(140f); Effect(); setRotation(130f); Effect(); setRotation(135f); Effect(); } else if (myAngle == FireAngle2D.UUU_LEFT) //Aimin UP LEFT { setRotation(117.5f); Effect(); setRotation(107.5f); Effect(); setRotation(112.5f); Effect(); } else { setRotation(lastRot + 5f); Effect(); setRotation(lastRot - 5f); Effect(); setRotation(lastRot); Effect(); } //Debug.Log(myAngle); }