void Shoot() { RaycastHit hit; //Calcula8r damage respecte temperatura damage = (damageMax - damageMin) * curve.Evaluate(heat) + damageMin; //Definir segons la funcio que volguem utilitzar pel calor i com crear-la. heat += heatStep; Debug.Log(curve.Evaluate(heat)); //Feedback jugador CameraShaker.Instance.Shake(screenShakeTime, screenShakeForce); muzzleFlash.Play(); //Calcular fisiques del raycast if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) { Debug.Log(hit.transform.name); target _target = hit.transform.GetComponent <target>(); if (_target != null) { _target.takeDamage(damage, impactForce, hit.point, hit.normal); } } //Feedback post dispar fpsCam.GetComponent <CamLook>().Recoil(recoilForce); GameObject impactGo = Instantiate(impactParticle, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(impactGo, 1); }
private void OnTriggerEnter2D(Collider2D collision) { Debug.Log(collision.name); target target = collision.transform.GetComponent <target>(); if (target) { target.takeDamage(damage); } Destroy(gameObject); }
void Shoot() { RaycastHit hit; if (Physics.Raycast(fpsCamera.transform.position, fpsCamera.transform.forward, out hit)) { Debug.Log(hit.transform.name); target t = hit.transform.GetComponent <target>(); if (t != null) { paintHit++; text.text = "HIT : " + paintHit.ToString(); t.takeDamage(10); } } }
void ShootABullet(Vector3 fromPoint, Vector3 direction, float damage) { RaycastHit hit; if (Physics.Raycast(fromPoint, direction, out hit, range)) { target _target = hit.transform.GetComponent <target>(); if (_target != null) { _target.takeDamage(damage, impactForce, hit.point, hit.normal); } } if (hit.normal != Vector3.zero) { GameObject impactGo = Instantiate(impactParticle, hit.point + hit.normal * 0.1f, Quaternion.LookRotation(hit.normal)); Destroy(impactGo, 1); } }
void PunchObj() { target.takeDamage(hitDamage); }