protected void RotateWeapon() { float angle = MyUtils.GetAngle(this.transform.position, target.position); if (weaponPosit != null) { weaponPosit.rotation = Quaternion.Euler(0f, 0f, angle); } //flip if ((angle >= 0f && angle <= 90) || angle >= 270f && angle <= 360) { if (nowWeapon != null) { nowWeapon.FlipWeapon(false); } } else { if (nowWeapon != null) { nowWeapon.FlipWeapon(true); } } }
protected void RotateWeapon() { Vector3 playerPos = Vector3.one; if (PlayerTr != null) { playerPos = PlayerTr.position; } float weaponAngle = MyUtils.GetAngle(playerPos, this.transform.position); if (weaponHandler1 != null) { weaponHandler1.transform.rotation = Quaternion.Euler(0f, 0f, weaponAngle); } if (weaponHandler2 != null) { weaponHandler2.transform.rotation = Quaternion.Euler(0f, 0f, weaponAngle); } //flip if ((weaponAngle >= 0f && weaponAngle <= 90) || weaponAngle >= 270f && weaponAngle <= 360) { if (weaponHandler1 != null) { weaponHandler1.FlipWeapon(false); FlipCharacter(false); } if (weaponHandler2 != null) { weaponHandler2.FlipWeapon(false); FlipCharacter(false); } } else { if (weaponHandler1 != null) { weaponHandler1.FlipWeapon(true); FlipCharacter(true); } if (weaponHandler2 != null) { weaponHandler2.FlipWeapon(true); FlipCharacter(true); } } }
protected void RotateWeapon(Vector3 enemyPos) { Vector3 nearestEnemyPos = enemyPos; weaponAngle = MyUtils.GetAngle(nearestEnemyPos, this.transform.position); if (weaponHandler.CanRotateWeapon() == true) { if (weaponPosit != null) { weaponPosit.rotation = Quaternion.Euler(0f, 0f, weaponAngle); } } else { if (weaponPosit != null) { weaponPosit.rotation = Quaternion.Euler(0f, 0f, 0f); } } //flip if ((weaponAngle >= 0f && weaponAngle <= 90) || weaponAngle >= 270f && weaponAngle <= 360) { if (weaponHandler != null) { if (weaponHandler.CanRotateWeapon() == true) { weaponHandler.FlipWeapon(false); } FlipCharacter(true); } } else { if (weaponHandler != null) { if (weaponHandler.CanRotateWeapon() == true) { weaponHandler.FlipWeapon(true); } FlipCharacter(false); } } }