Exemple #1
0
    public static void Shake(MoveEditor.CameraShakeEventInfo info, bool isCrit = false)
    {
        shakes = CameraShake.GetComponents();

        if (shakes.Length == 0)
        {
            EB.Debug.LogWarning("DoShake: CameraShake instance is null");
            return;
        }

        var props = info._cameraShakeProperties;

        if (isCrit)
        {
            for (int i = 0, len = shakes.Length; i < len; ++i)
            {
                CameraShake shake = shakes[i];
                shake.Shake(shake.shakeType, props._numberOfShakesCrit, props._shakeAmountCrit, props._rotationAmountCrit,
                            props._distanceCrit, props._speedCrit, props._decayCrit, shake.uiShakeModifier,
                            props._multiplyByTimeScale, null);
            }
        }
        else
        {
            for (int i = 0, len = shakes.Length; i < len; ++i)
            {
                CameraShake shake = shakes[i];
                shake.Shake(shake.shakeType, props._numberOfShakes, props._shakeAmount, props._rotationAmount,
                            props._distance, props._speed, props._decay, shake.uiShakeModifier,
                            props._multiplyByTimeScale, null);
            }
        }
    }
Exemple #2
0
    private void PlayEffects(ProjectileEvent projectileEvent)
    {
        if (_fxHelper == null)
        {
            return;
        }

        for (int j = 0; j < projectileEvent._particles.Count; ++j)
        {
            MoveEditor.ParticleEventInfo particleEventInfo = projectileEvent._particles[j];

            // Dirty hack here - if the particle's set to spawn at hit point, we call the player's FXHelper
            // the reason being that if we don't then the effects will get destroyed since the projectile would likely be deactivated on hit, thus destroying all its fx
            if (particleEventInfo._particleProperties._spawnAtHitPoint)
            {
                MoveEditor.MoveAnimationEvent moveEvent = new MoveEditor.MoveAnimationEvent()
                {
                    EventRef = particleEventInfo
                };
                _owner.OnHandleMessage("OnPlayParticle", moveEvent);
                //_owner.FXHelper.PlayParticle(particleEventInfo._particleProperties);
            }
            else
            {
                _fxHelper.PlayParticle(particleEventInfo._particleProperties);
            }
        }

        for (int j = 0; j < projectileEvent._trails.Count; ++j)
        {
            MoveEditor.TrailRendererEventInfo trailEventInfo = projectileEvent._trails[j];
            _fxHelper.PlayTrailRenderer(trailEventInfo._trailRendererProperties);
        }

        for (int j = 0; j < projectileEvent._dynamicLights.Count; ++j)
        {
            MoveEditor.DynamicLightEventInfo dynamicLights = projectileEvent._dynamicLights[j];
            _fxHelper.PlayDynamicLight(dynamicLights._dynamicLightProperties);
        }

        AttributeData attr = _owner.OnGetAttributeData("IsCurrentAttackCritical");

        for (int i = 0; i < projectileEvent._cameraShakes.Count; ++i)
        {
            MoveEditor.CameraShakeEventInfo shakeInfo = projectileEvent._cameraShakes[i];
            MoveCameraShakeHelper.Shake(shakeInfo, _owner != null && attr.IsCurrentAttackCritical);
        }
    }