Esempio n. 1
0
 public void Initialize(bool shouldActivate, GadgetShotLaserPoint previousPoint, int damageToDeal)
 {
     this.shouldActive = shouldActivate;
     this.prevPoint    = previousPoint;
     this.hitBoxDamageAmount.originDamage = damageToDeal;
     this.hitBoxDamageAmount.updateDamage();
 }
Esempio n. 2
0
    private void OnCollisionStay2D(Collision2D collision)
    {
        if (collision.gameObject.layer == 12 && canCollide && !impacted)
        {
            StartCoroutine(canCollideDelay());
            Vector3 normalVector = collision.GetContact(0).normal;
            travelVector = Vector3.Reflect(travelVector, normalVector);

            numberBounces--;

            if (numberBounces > 0)
            {
                particlesInstant.transform.rotation = Quaternion.Euler(0, 0, Mathf.Atan2(travelVector.y, travelVector.x) * Mathf.Rad2Deg + 90);
            }

            bounceAudio.Play();

            animator.SetTrigger("Impact" + extraAnimPrefix);

            damageAmount.originDamage += 1;
            damageAmount.updateDamage();

            if (whatShotType == 1)
            {
                GameObject explosionInstant = Instantiate(explosion, transform.position, Quaternion.identity);

                switch (tier)
                {
                case 4:
                    explosionInstant.GetComponent <GadgetShotExplosion>().Initialize(4, 2);
                    break;

                case 5:
                    explosionInstant.GetComponent <GadgetShotExplosion>().Initialize(8, 2);
                    break;

                case 6:
                    explosionInstant.GetComponent <GadgetShotExplosion>().Initialize(8, 4);
                    break;
                }
            }
            else if (whatShotType == 2)
            {
                GameObject           laserPointInstant = Instantiate(laserPoint, transform.position, Quaternion.identity);
                GadgetShotLaserPoint laserPointScript  = laserPointInstant.GetComponent <GadgetShotLaserPoint>();

                switch (tier)
                {
                case 4:
                    if (spawnedLaserPoints.Count == 0)
                    {
                        laserPointScript.Initialize(false, null, 4);
                    }
                    else
                    {
                        laserPointScript.Initialize(true, spawnedLaserPoints[spawnedLaserPoints.Count - 1], 4);
                    }
                    break;

                case 5:
                    if (spawnedLaserPoints.Count == 0)
                    {
                        laserPointScript.Initialize(false, null, 8);
                    }
                    else
                    {
                        laserPointScript.Initialize(true, spawnedLaserPoints[spawnedLaserPoints.Count - 1], 8);
                    }
                    break;

                case 6:
                    if (spawnedLaserPoints.Count == 0)
                    {
                        laserPointScript.Initialize(false, null, 8);
                    }
                    else
                    {
                        laserPointScript.Initialize(true, spawnedLaserPoints[spawnedLaserPoints.Count - 1], 8);
                    }
                    break;
                }

                spawnedLaserPoints.Add(laserPointScript);
            }
        }
    }