public Action <float> ContinuousScreenShake(float initialStrength, float frequency) { float strength = initialStrength; IEnumerator ScreenShakeCoroutine() { TransformEffect t = new TransformEffect(); _transformEffects.Add(t); while (strength > 0f) { t.position = new Vector3((Mathf.PerlinNoise(Time.timeSinceLevelLoad * frequency, 0f) * 2f - 1f) * strength * 0.5f, (Mathf.PerlinNoise(Time.timeSinceLevelLoad * frequency, 3f) * 2f - 1f) * strength * 0.5f, (Mathf.PerlinNoise(Time.timeSinceLevelLoad * frequency, 7f) * 2f - 1f) * strength * 0.5f); t.rotation = Quaternion.Euler(Vector3.forward * ((Mathf.PerlinNoise(Time.timeSinceLevelLoad * frequency, 11f) * 2f - 1f) * strength * 0.5f * cameraShakeRotationMultiplier)); yield return(null); } _transformEffects.Remove(t); }; _mainCameraRef.StartCoroutine(ScreenShakeCoroutine()); return((float value) => strength = value); }
public void ApplyImpulse(Vector3 sourcePos, float strength, float duration = 0.5f) { IEnumerator ImpulseCoroutine() { Vector3 startOffset = (_mainCameraRef.transform.position - sourcePos).normalized * strength; TransformEffect t = new TransformEffect() { position = startOffset, rotation = Quaternion.identity }; _transformEffects.Add(t); for (float timer = 0.0f; timer < duration; timer += Time.deltaTime) { t.position = Vector3.Lerp(Vector3.zero, startOffset, impulseCurve.Evaluate(timer / duration)); yield return(null); } _transformEffects.Remove(t); }; _mainCameraRef.StartCoroutine(ImpulseCoroutine()); }
public void ApplyScreenShake(float strength, float frequency, float duration) { IEnumerator ScreenShakeCoroutine() { TransformEffect t = new TransformEffect(); _transformEffects.Add(t); for (float timer = 0.0f; timer < duration; timer += Time.deltaTime) { //UnityEngine.Random.insideUnitSphere * strength * Mathf.Clamp01(Mathf.Pow(1f - timer / duration, screenShakeExponent)); float tValue = Mathf.Pow(1f - timer / duration, screenShakeExponent); t.position = new Vector3((Mathf.PerlinNoise(Time.timeSinceLevelLoad * frequency, 0f) * 2f - 1f) * strength * tValue * 0.5f, (Mathf.PerlinNoise(Time.timeSinceLevelLoad * frequency, 3f) * 2f - 1f) * strength * tValue * 0.5f, (Mathf.PerlinNoise(Time.timeSinceLevelLoad * frequency, 7f) * 2f - 1f) * strength * tValue * 0.5f); t.rotation = Quaternion.Euler(Vector3.forward * ((Mathf.PerlinNoise(Time.timeSinceLevelLoad * frequency, 11f) * 2f - 1f) * strength * 0.5f * tValue * cameraShakeRotationMultiplier)); yield return(null); } _transformEffects.Remove(t); }; _mainCameraRef.StartCoroutine(ScreenShakeCoroutine()); }
/// <summary> /// 处理对方的动作 /// </summary> /// <param name="ActionCommand"></param> /// <param name="game"></param> public static void Process(string ActionCommand, ActionStatus game) { string[] actField = ActionCommand.Split(CardUtility.strSplitMark.ToCharArray()); switch (ActionCode.GetActionType(ActionCommand)) { case ActionCode.ActionType.Card: CardEffect.ReRunEffect(1, game, actField); break; case ActionCode.ActionType.UseMinion: int Pos = int.Parse(actField[2]); var minion = (MinionCard)CardUtility.GetCardInfoBySN(actField[1]); minion.初始化(); game.AllRole.YourPublicInfo.BattleField.PutToBattle(Pos, minion); Buff.ResetBuff(game); break; case ActionCode.ActionType.UseWeapon: game.AllRole.YourPublicInfo.Hero.Weapon = (WeaponCard)CardUtility.GetCardInfoBySN(actField[1]); break; case ActionCode.ActionType.UseSecret: game.AllRole.YourPublicInfo.Hero.SecretCount++;; break; case ActionCode.ActionType.UseAbility: break; case ActionCode.ActionType.Fight: //FIGHT#1#2 FightHandler.Fight(int.Parse(actField[2]), int.Parse(actField[1]), game, false); break; case ActionCode.ActionType.Point: IAtomicEffect point = new PointEffect(); point.ReRunEffect(game, actField); break; case ActionCode.ActionType.Health: IAtomicEffect health = new HealthEffect(); health.ReRunEffect(game, actField); break; case ActionCode.ActionType.Status: IAtomicEffect status = new StatusEffect(); status.ReRunEffect(game, actField); break; case ActionCode.ActionType.Transform: IAtomicEffect transform = new TransformEffect(); transform.ReRunEffect(game, actField); break; case ActionCode.ActionType.Attack: IAtomicEffect attack = new AttackEffect(); attack.ReRunEffect(game, actField); break; case ActionCode.ActionType.HitSecret: SecretCard.ReRunSecret(game, actField); break; case ActionCode.ActionType.Control: ControlEffect.ReRunEffect(game, actField); break; case ActionCode.ActionType.Summon: SummonEffect.ReRunEffect(game, actField); break; case ActionCode.ActionType.Crystal: CrystalEffect.ReRunEffect(game, actField); break; case ActionCode.ActionType.WeaponPoint: WeaponPointEffect.ReRunEffect(game, actField); break; case ActionCode.ActionType.Settle: ActionStatus.Settle(game); break; } }
/// <summary> /// 运行效果 /// </summary> /// <param name="game"></param> /// <param name="actField"></param> private static void RunNormalEffect(GameManager game, string[] actField) { //ATTACK#ME#POS#AP //Me代表对方 YOU代表自己,必须反过来 IEffectHandler handler = new AttackEffect(); EffectDefine SingleEffect = new EffectDefine(); switch (actField[0]) { case Card.Server.ActionCode.strAttack: handler = new AttackEffect(); SingleEffect.ActualEffectPoint = int.Parse(actField[3]); break; case Card.Server.ActionCode.strHealth: handler = new HealthEffect(); SingleEffect.ActualEffectPoint = int.Parse(actField[3]); if (actField.Length == 5) { SingleEffect.AdditionInfo = actField[4]; } break; case Card.Server.ActionCode.strStatus: handler = new StatusEffect(); SingleEffect.AdditionInfo = actField[3]; break; case Card.Server.ActionCode.strPoint: handler = new PointEffect(); SingleEffect.AdditionInfo = actField[3]; SingleEffect.StandardEffectPoint = int.Parse(actField[4]); break; case Card.Server.ActionCode.strTransform: handler = new TransformEffect(); SingleEffect.AdditionInfo = actField[3]; break; } if (actField[1] == CardUtility.strYou) { switch (int.Parse(actField[2])) { case BattleFieldInfo.HeroPos: handler.DealHero(game, SingleEffect, true); break; case BattleFieldInfo.AllPos: for (int i = 0; i < game.MyInfo.BattleField.MinionCount; i++) { handler.DealMinion(game, SingleEffect, true, i); } break; default: handler.DealMinion(game, SingleEffect, true, int.Parse(actField[2]) - 1); break; } } else { switch (int.Parse(actField[2])) { case BattleFieldInfo.HeroPos: handler.DealHero(game, SingleEffect, false); break; case BattleFieldInfo.AllPos: for (int i = 0; i < game.YourInfo.BattleField.MinionCount; i++) { handler.DealMinion(game, SingleEffect, false, i); } break; default: handler.DealMinion(game, SingleEffect, false, int.Parse(actField[2]) - 1); break; } } }
public void DoTransform(Mobile m, int body, int hue, TransformEffect effect) { //LastTransform(); TransformEffect temp = effect; temp.Transform(m); m.Body = body; m.Hue = hue; }
public virtual double DispelFocus{ get{ return 20.0; } } // at difficulty - focus we have 0%, at difficulty + focus we have 100% #region Transformations/body/hue morphing //public virtual bool CanTransform() { return true; } //public virtual void LastTransform() { return ; } public virtual void DoTransform(Mobile m, int body, TransformEffect effect) { if (m != null) DoTransform(m, body, m.Hue, effect); }