예제 #1
0
    private void Detenation()
    {
        Vector3 explosionPos = instantiatedExplosion.transform.position;

        Collider[] colliders = Physics.OverlapSphere(explosionPos, gameManager.flagExplosionRadius);
        foreach (Collider hit in colliders)
        {
            Rigidbody rb = hit.GetComponent <Rigidbody>();
            EnemyBoat enemyPowerReduced    = hit.GetComponent <EnemyBoat>();
            WaterBoat friendlyPowerReduced = hit.GetComponent <WaterBoat>();

            if (rb != null)
            {
                rb.AddExplosionForce(gameManager.flagExplosionPower, explosionPos, gameManager.flagExplosionRadius, gameManager.flagExplosionupForce, ForceMode.Impulse);
                if (enemyPowerReduced != null)
                {
                    enemyPowerReduced.Power -= 1f;
                }
                else if (friendlyPowerReduced != null)
                {
                    friendlyPowerReduced.Power -= 1f;
                }
            }
        }
    }
예제 #2
0
 // Start is called before the first frame update
 void Start()
 {
     waves          = FindObjectOfType <Waves>();
     boatController = FindObjectOfType <WaterBoat>();
     sunParticle.Play();
     rainParticle.Stop();
 }