void Shoot()
{
if (Input.GetKeyDown(KeyCode.Mouse0) && readyToShoot == true)
{
readyToShoot = false;
Invoke("ResetShot", timeBetweenShooting);
anim.SetInteger("Fire", 1);
}
}
void ResetShot()
{
readyToShoot = true;
anim.SetInteger("Fire", 0);
}
private void Update()
{
float dis = 3.5f;
RaycastHit hit;
if (Physics.Raycast(playerCamera.GetComponent<Camera>().transform.position, playerCamera.GetComponent<Camera>().transform.forward, out hit, dis))
{
InfoObject infoObject = hit.transform.GetComponent<InfoObject>();
if (infoObject != null)
{
infoObjectText.text = infoObject.nameObj + "\n" +
+ infoObject.hpObj + " / " + infoObject.maxHpObj;
infoObjectText.enabled = true;
}
if (infoObject == null)
{
infoObjectText.enabled = false;
}
}
}
public LayerMask whatIsGround;
private bool isGrounded = false;
private float groundRadius = 0.2f;
public Transform groundCheck;
private void FixedUpdate()
{
isGrounded = Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround);
}
private void Update()
{
if(isGrounded == true)
{
Pipirka();
}
}
но: или я не знаю как работает "for", или не знаю как внедрить его к моему случаю.