Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (playerBuff.ATK_BUFF())
        {
            ATK_text.enabled = true;
        }
        else
        {
            ATK_text.enabled = false;
        }

        if (playerBuff.DFS_BUFF())
        {
            DPS_text.enabled = true;
        }
        else
        {
            DPS_text.enabled = false;
        }

        if (playerBuff.SPD_BUFF())
        {
            SPD_text.enabled = true;
        }
        else
        {
            SPD_text.enabled = false;
        }
    }
Example #2
0
    void Shoot()
    {
        timer = 0;

        gunAudio.Play();

        gunParticle.Stop();
        gunParticle.Play();

        gunLight.enabled = true;
        gunLine.enabled  = true;
        gunLine.SetPosition(0, transform.position);

        gunRay.origin    = transform.position;
        gunRay.direction = transform.forward + new Vector3(1f, 1f, 0f) * Random.Range(-0.03f, 0.03f) + new Vector3(-1f, 1f, 0f) * Random.Range(-0.03f, 0.03f);

        if (Physics.Raycast(gunRay, out gunRayHit, range, shootablemask))
        {
            EnemyHealth enemyHealth = null;

            if (gunRayHit.collider.tag == "Enemy")
            {
                enemyHealth = gunRayHit.collider.GetComponent <EnemyHealth>();

                if (enemyHealth != null)
                {
                    if (playerBuff.ATK_BUFF())
                    {
                        shootdamage = 12;
                    }
                    else
                    {
                        shootdamage = 10;
                    }

                    enemyHealth.TakeDamage(shootdamage, gunRayHit.point);
                }
            }

            else if (gunRayHit.collider.tag == "EnemyPlayer")
            {
                enemy_Player.Hit(gunRayHit.point);
            }

            gunLine.SetPosition(1, gunRayHit.point);
        }
        else
        {
            gunLine.SetPosition(1, gunRay.origin + gunRay.direction * range);
        }
    }