/// <summary> /// 抖动屏幕 /// <para>delay</para> /// <para>duration</para> /// <para>interval 抖动间隔</para> /// <para>shakeLevel 震幅</para> /// <para>minShakeLevel 最小震幅</para> /// <para>maxRange 最大范围</para> /// </summary> /// <param name="luaState"></param> /// <returns></returns> public static int ShakeScreen(ILuaState luaState) { ShakeEffect effect = EffectsManager.GetInstance().CreateEffectByType(EffectType.ShakeEffect) as ShakeEffect; string name = luaState.ToString(-7); int delay = luaState.ToInteger(-6); int shakeDuration = luaState.ToInteger(-5); int shakeInterval = luaState.ToInteger(-4); float shakeLevel = (float)luaState.ToNumber(-3); float minShakeLevel = (float)luaState.ToNumber(-2); float maxRange = (float)luaState.ToNumber(-1); effect.SetName(name); effect.DoShake(delay, shakeDuration, shakeInterval, shakeLevel, minShakeLevel, maxRange); return(0); }
private void CollidedByEnemyCallback(ObjectColliderBase collider, ICollisionObject enemy) { ClearCollider(); if (!_isFinish) { Explode(); ShakeEffect effect = EffectsManager.GetInstance().CreateEffectByType(EffectType.ShakeEffect) as ShakeEffect; effect.DoShake(0, 5, 1, 5); //ObjectColliderBase newCollider = ColliderManager.GetInstance().CreateColliderByType(eColliderType.Circle); //newCollider.SetSize(_size, _size); //newCollider.SetPosition(_curPos); //newCollider.SetEliminateType(eEliminateDef.PlayerSpellCard); //newCollider.SetColliderGroup(eColliderGroup.Enemy | eColliderGroup.EnemyBullet); //newCollider.SetHitEnemyDamage(_dmg); //newCollider.SetExistDuration(1); _isFinish = true; } }
public override void Start() { _masterSparkObject = ResourceManager.GetInstance().GetPrefab("Prefab/Character/MarisaA", "MasterSpark"); UIManager.GetInstance().AddGoToLayer(_masterSparkObject, LayerId.PlayerBarage); _masterSparkTf = _masterSparkObject.transform; Vector2 playerPos = Global.PlayerPos; Vector3 pos = new Vector3(playerPos.x + _posOffset.x, playerPos.y + _posOffset.y, MasterSparkPosZ); _masterSparkTf.localPosition = pos; Transform tf; for (int i = 0; i < MovementObjectCount; i++) { tf = _masterSparkTf.Find("SparkWave" + i); _movementObjectTfList.Add(tf); } _sparkContainerTf = _masterSparkTf.Find("SparkContainer"); _movementBodyTf = _sparkContainerTf.Find("MovementBody"); // 黑底 _effect = EffectsManager.GetInstance().CreateEffectByType(EffectType.SpriteEffect) as STGSpriteEffect; _effect.SetSprite("ShapeAtlas", "ShapeCircle", eBlendMode.Normal, LayerId.STGBottomEffect, false); _effect.SetSize(0, 0); _effect.SetSpriteColor(0, 0, 0, 1); _effect.ChangeWidthTo(1024, 50, InterpolationMode.EaseInQuad); _effect.ChangeHeightTo(1024, 50, InterpolationMode.EaseInQuad); _effect.SetPosition(playerPos.x, playerPos.y); // 基础属性 _curState = 1; _time = 0; _duration = 30; _isFinish = false; // 震动 ShakeEffect shakeEffect = EffectsManager.GetInstance().CreateEffectByType(EffectType.ShakeEffect) as ShakeEffect; shakeEffect.DoShake(0, 270, 3, 3f, 1.5f, 5); // 音效 SoundManager.GetInstance().Play("se_masterspark", 0.1f, false, true); }