// Update is called once per frame void Update() { RaycastHit hit; Vector3 rayOriginVector3 = mainCamera.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0)); if (Input.GetButtonDown("Fire1")) { if (GlobalValues.Ammo > 0) { GlobalValues.Ammo -= 1; if (Physics.Raycast(rayOriginVector3, mainCamera.transform.forward, out hit, range)) { IDmg dmg = hit.collider.gameObject.GetComponent <IDmg>(); if (dmg != null) { dmg.TakeDamage(damage); } } } else { GlobalValues.Realod(); } } }
void OnCollisionEnter(Collision col) { Debug.Log("hit"); IDmg dmg = col.gameObject.GetComponent <IDmg>(); if (dmg != null) { dmg.TakeDamage(10); } }
public DrawManager(ISpellConfig spellConfig, IInsecManager insecManager, IDmg damage) { _spellConfig = spellConfig; _insecManager = insecManager; _damage = damage; }
public DrawManager(ISpellConfig spellConfig, IInsecManager insecManager, IDmg damage) { this.spellConfig = spellConfig; this.insecManager = insecManager; this.damage = damage; }