Exemplo n.º 1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     for (int i = 0; i < deathEffectParticles; i++)
     {
         Instantiate(deathParticle, transform.position, Quaternion.identity);
     }
     die = collision.GetComponentInChildren <ZombieInfectionController>();
     die.GotGrenaded();
 }
Exemplo n.º 2
0
    public void NERFShoot()
    {
        RaycastHit2D hit = Physics2D.Linecast(BoTransform.position, shootingDirection.position, layerMask);

        Debug.DrawLine(BoTransform.position, shootingDirection.position, Color.green, 20f);

        if (hit.collider != null)
        {
            Vector3 hitPoint = new Vector3(hit.point.x, hit.point.y, 0f);

            Instantiate(nERFHitPointParticle, hitPoint, Quaternion.identity);

            if (hit.collider.tag == "Enemy")
            {
                if (Input.GetKeyDown(KeyCode.Mouse1))
                {
                    zombieInfection = hit.collider.gameObject.GetComponentInChildren <ZombieInfectionController>();
                    zombieInfection.GotGrenaded();
                }
            }
        }
    }
Exemplo n.º 3
0
    public void Shoot()
    {
        //Creates a new Vector2 using the the first components x and y transforms
        RaycastHit2D hit = Physics2D.Linecast(BoTransform.position, shootingDirection.position, layerMask);

        Debug.DrawLine(BoTransform.position, shootingDirection.position, Color.green, 20f);

        float shootingParticles = Random.Range(2, 4);

        for (int i = 0; i < shootingParticles; i++)
        {
            Instantiate(shootingParticle, fireworksLaunchPoint.position, Quaternion.identity);
        }

        //If the collider hits anything, it will check if it's a target. The collider hit belongs
        //to an object tagged as target, it will use the EnemyHealthController to lower the targets health
        if (hit.collider != null)
        {
            Vector3 hitPoint = new Vector3(hit.point.x, hit.point.y, 0f);

            float hitPointParticles = Random.Range(2, 6);

            for (int i = 0; i < hitPointParticles; i++)
            {
                Instantiate(hitPointParticle, hitPoint, Quaternion.identity);
            }

            if (hit.collider.tag == "Enemy")
            {
                if (Input.GetKeyDown(KeyCode.Mouse0))
                {
                    zombieInfection = hit.collider.gameObject.GetComponentInChildren <ZombieInfectionController>();
                    zombieInfection.GotShot();
                }
            }
        }
    }