Beispiel #1
0
    // 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();
            }
        }
    }
Beispiel #2
0
    void OnCollisionEnter(Collision col)
    {
        Debug.Log("hit");
        IDmg dmg = col.gameObject.GetComponent <IDmg>();

        if (dmg != null)
        {
            dmg.TakeDamage(10);
        }
    }
Beispiel #3
0
 public DrawManager(ISpellConfig spellConfig, IInsecManager insecManager, IDmg damage)
 {
     _spellConfig  = spellConfig;
     _insecManager = insecManager;
     _damage       = damage;
 }
Beispiel #4
0
 public DrawManager(ISpellConfig spellConfig, IInsecManager insecManager, IDmg damage)
 {
     this.spellConfig  = spellConfig;
     this.insecManager = insecManager;
     this.damage       = damage;
 }