コード例 #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();
 }
コード例 #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();
                }
            }
        }
    }