Пример #1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (tag == ObjectsDescription.EnemyProjectile.ToString())
        {
            if (other.gameObject.tag == ObjectsDescription.Player.ToString() || other.gameObject.tag == ObjectsDescription.PlayerProjectile.ToString())
            {
                Destroy(gameObject);
                vfxControllerClass.InitiateCameraShakeEffect(cameraShakeDuration);
                vfxControllerClass.InitiateScreenRippleEffect(transform.position);
                vfxControllerClass.InitiateExplodeEffect(transform.position);
            }

            else if (other.gameObject.tag == ObjectsDescription.EnemyObject.ToString())
            {
                Destroy(gameObject);
                vfxControllerClass.InitiateExplodeEffect(transform.position);
            }
        }
    }
Пример #2
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (tag == ObjectsDescription.EnemyProjectile.ToString() && isGranadeMoving)
        {
            if (other.gameObject.tag == ObjectsDescription.PlayerProjectile.ToString())
            {
                taskHandlerClass.UpdateLevelTaskState(ObjectsDescription.EnemyProjectile, TaskTypes.Destroy, TaskCategory.CountingTask, new List <string>()
                {
                });
            }

            if (other.gameObject.tag == ObjectsDescription.Player.ToString() || other.gameObject.tag == ObjectsDescription.PlayerProjectile.ToString())
            {
                Destroy(gameObject);
                vfxControllerClass.InitiateCameraShakeEffect(cameraShakeDuration);
                vfxControllerClass.InitiateScreenRippleEffect(transform.position);
                vfxControllerClass.InitiateExplodeEffect(transform.position);
            }

            else if (other.gameObject.tag == ObjectsDescription.EnemyObject.ToString())
            {
                Destroy(gameObject);
                vfxControllerClass.InitiateExplodeEffect(transform.position);
            }
        }
        else if (tag == ObjectsDescription.PlayerProjectile.ToString())
        {
            if (other.gameObject.tag == ObjectsDescription.EnemyLauncher.ToString())
            {
                vfxControllerClass.InitiateCameraShakeEffect(cameraShakeDuration);
                GameObject launcher = other.transform.parent.gameObject;
                vfxControllerClass.InitiateScreenRippleEffect(launcher.transform.position);
                vfxControllerClass.InitiateExplodeEffect(launcher.transform.position);
                taskHandlerClass.UpdateLevelTaskState(ObjectsDescription.EnemyLauncher, TaskTypes.Destroy, TaskCategory.CountingTask, new List <string>()
                {
                });
                AudioSource.PlayClipAtPoint(enemyLauncherDeathSFX, mainCameraPos, playerStatsClass.sfxVolume);
                Destroy(launcher);
                Destroy(gameObject);
            }
        }
    }