public void Execute() { try { bool exec = false; InvokeMode mode = InvokeMode.im_ItSelf; switch (Action) { case EffectAction.ea_Instant: // dummy break; case EffectAction.ea_Persistent: exec = (Duration == 1); mode = InvokeMode.im_FinAction; break; case EffectAction.ea_EachTurn: exec = true; break; case EffectAction.ea_RandomTurn: exec = AuxUtils.Chance(10); break; case EffectAction.ea_LastTurn: exec = (Duration == 1); break; } if (exec) { EffectID eid = (EffectID)CLSID; if (this is MapEffect) { EffectExt ext = ((MapEffect)this).Ext; InvokeEffect(eid, null, Source, mode, EffectAction.ea_Instant, ext); } else { NWCreature creature = (NWCreature)Owner; int lid = (creature.CurrentField).LandID; bool LocusValid = (eid == EffectID.eid_Relocation) && creature.IsPlayer && creature.Effects.FindEffectByID(EffectID.eid_LocusMastery) != null && lid != GlobalVars.Land_Valhalla && lid != GlobalVars.Land_Vigrid && lid != GlobalVars.Land_Bifrost && lid != GlobalVars.Land_Nidavellir && lid != GlobalVars.Land_Niflheim && lid != GlobalVars.Land_Ocean; if (LocusValid) { EffectExt ext = new EffectExt(); ext.ReqParams = new EffectParams(EffectParams.ep_Place); GlobalVars.nwrWin.InitTarget(EffectID.eid_Relocation, null, mode, ext); } else { creature.UseEffect(eid, Source, mode, null); } } } } catch (Exception ex) { Logger.Write("Effect.execute(): " + ex.Message); } }
public IPacket ReadPacket(IMinecraftDataReader reader) { EntityID = reader.ReadVarInt(); EffectID = (EffectID) reader.ReadSByte(); return this; }
protected override void ShowAnimation(EffectID animationID) { KillAnimationJob(); switch (animationID) { case EffectID.Dying: base.ShowAnimation(animationID); break; case EffectID.Hit: base.ShowAnimation(animationID); break; case EffectID.Attacking: ShowAttacking(); break; case EffectID.CmdHit: ShowCmdHit(); break; case EffectID.Disbanding: ShowDisbanding(); break; case EffectID.Refitting: ShowRefitting(); break; case EffectID.Repairing: ShowRepairing(); break; case EffectID.None: default: throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(animationID)); } }
public static GameObject Create(EffectID effectID) { Animator effectObject = null; if (effectID == EffectID.Sparksfly) { effectObject = Create("Sparksfly"); } else if (effectID == EffectID.Vanishes) { effectObject = Create("Vanishes"); } else { Debug.LogError("not match EffectID id: " + effectID); } float effectLength = effectObject.GetCurrentAnimatorStateInfo(0).length; Sequence sequence = DOTween.Sequence(); sequence.AppendInterval(effectLength); sequence.AppendCallback(() => GameObject.Destroy(effectObject.gameObject)); sequence.Play(); return(effectObject.gameObject); }
public IPacket ReadPacket(IMinecraftDataReader reader) { EntityID = reader.ReadVarInt(); EffectID = (EffectID)reader.ReadSByte(); return(this); }
public static bool Rect(this EffectID ID) { bool isRect = false; switch (ID) { case EffectID.CheckPoint: isRect = false; break; case EffectID.ClearEffect: isRect = false; break; case EffectID.Console: isRect = true; break; case EffectID.DestoryEnemy: isRect = false; break; case EffectID.DestoryObj: isRect = false; break; case EffectID.EnemyDistinction: isRect = false; break; case EffectID.EnemyRecovery: isRect = true; break; case EffectID.EnemyRespown: isRect = false; break; case EffectID.GoalPoint: isRect = false; break; case EffectID.LookOn: isRect = true; break; case EffectID.Numparent: isRect = false; break; case EffectID.ParticleLight: isRect = false; break; case EffectID.Wave: isRect = false; break; } return(isRect); }
public SkillRec(int name, SkillKind kinds, string gfx, EffectID effect) { Name = name; Kinds = kinds; Gfx = gfx; Effect = effect; ImageIndex = -1; }
public IPacket ReadPacket(IMinecraftDataReader reader) { EffectID = (EffectID) reader.ReadInt(); Location = Position.FromReaderLong(reader); Data = reader.ReadInt(); DisableRelativeVolume = reader.ReadBoolean(); return this; }
public IPacket ReadPacket(IMinecraftDataReader reader) { EffectID = (EffectID)reader.ReadInt(); Location = Position.FromReaderLong(reader); Data = reader.ReadInt(); DisableRelativeVolume = reader.ReadBoolean(); return(this); }
public Effect(GameSpace space, object owner, EffectID eID, object source, EffectAction actionKind, int duration, int magnitude) : base(space, owner) { CLSID = (int)eID; Action = actionKind; Duration = duration; Magnitude = magnitude; Source = source; }
public IPacket ReadPacket(IMinecraftDataReader reader) { EntityID = reader.ReadVarInt(); EffectID = (EffectID)reader.ReadSByte(); Amplifier = reader.ReadSByte(); Duration = reader.ReadVarInt(); HideParticles = reader.ReadBoolean(); return(this); }
/// <summary> /// Effect再生 /// </summary> /// <param name="_id">Effect ID</param> /// <param name="_pos">再生場所</param> public void PlayEffect(EffectID _id, Vector3 _pos) { var data = m_effectDatas.Find(dt => dt.ID == _id); if (data == null) { Debug.LogError(_id + " object isn't registered."); } Instantiate(data.EffectObj, _pos, quaternion.identity); }
public IPacket ReadPacket(IMinecraftDataReader reader) { EntityID = reader.ReadVarInt(); EffectID = (EffectID) reader.ReadSByte(); Amplifier = reader.ReadSByte(); Duration = reader.ReadVarInt(); HideParticles = reader.ReadBoolean(); return this; }
public static SkillRec Create(int name, SkillKind kinds, string gfx, EffectID effect) { SkillRec result = new SkillRec(); result.Name = name; result.Kinds = kinds; result.gfx = gfx; result.Effect = effect; result.ImageIndex = -1; return(result); }
public virtual void InitByEffect(EffectID effectID) { int eid = (int)effectID; EffectRec effRec = EffectsData.dbEffects[eid]; if (effRec.FrameCount > 0) { AnimKind = effRec.AnimationKind; ImagesOrigin = effRec.ImageIndex; FramesCount = (int)effRec.FrameCount; } }
public override void UseEffect(EffectID effectID, object source, InvokeMode invokeMode, EffectExt ext) { bool paramsValid = Effect.InitParams(effectID, this, source, invokeMode, ref ext); if (paramsValid) { base.UseEffect(effectID, source, invokeMode, ext); } else { GlobalVars.nwrWin.InitTarget(effectID, source, invokeMode, ext); } }
public PlaceRec(int name, string imageName, SymbolID symbol, PlaceFlags signs, Movements movements, int subTiles, EffectID effect) { NameRS = name; ImageName = imageName; Symbol = symbol; Signs = signs; Moves = movements; SubTiles = subTiles; Effect = effect; ImageIndex = -1; SubsLoaded = 0; }
protected virtual void ShowAnimation(EffectID animationID) { KillAnimationJob(); switch (animationID) { case EffectID.Dying: ShowDying(); break; case EffectID.Hit: ShowHit(); break; default: throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(animationID)); } }
public static void InvokeEffect(EffectID effectID, LocatedEntity creature, object source, InvokeMode invokeMode, EffectAction action, EffectExt ext) { if (effectID == EffectID.eid_None) { return; } try { if (creature != null) { GameEvent @event = new GameEvent(GameSpace.Instance, null); @event.CLSID = (int)effectID; @event.SetPos(creature.PosX, creature.PosY); GlobalVars.nwrWin.DoEvent(EventID.event_EffectSound, null, null, @event); @event.Dispose(); } ItemState state; if (source != null && source is Item) { state = ((Item)source).State; } else { state = ItemState.is_Normal; } bool valid = (ext == null || ext.Valid); if (valid) { IEffectProc proc = EffectsData.dbEffectProcs[(int)effectID].Proc; if (proc != null) { proc.Invoke(effectID, (NWCreature)creature, source, state, invokeMode, ext); } } } catch (Exception ex) { //EffectsData.dbEffects[(int)effectID] string msg = "Effect.invokeEffect(): " + effectID.ToString(); if (creature != null) { msg = msg + "/" + ((NWCreature)creature).Entry.Sign; } if (source != null && source is Item) { msg = msg + "/" + ((Item)source).Entry.Sign; } msg = msg + ", " + ex.Message; Logger.Write(msg); } }
protected override void Parse(EndianBinaryReader r) { EffectID = (SoundEffects)r.ReadInt32(); Position = CoordInt.Read(r); SoundData = r.ReadInt32(); SoundByte = r.ReadByte(); //Debug.WriteLine(DebugPacket.Read(r)); #if DEBUGPACKET if (EffectID.ToString() == ((int)EffectID).ToString()) { throw new NotImplementedException(EffectID.ToString()); } #endif }
public Effect FindEffectByID(EffectID eid) { int num = Count; for (int i = 0; i < num; i++) { Effect ef = GetItem(i); if (ef.CLSID == (int)eid) { return(ef); } } return(null); }
public static EffectController PlayEffect(EffectID effectID, Vector3 pos) { foreach (var effect in instance.effectPoolList[effectID]) { if (effect.IsActive()) { continue; } effect.Play(pos); return(effect); } return(null); }
//エフェクト生成(作るだけ,破壊時間指定) public virtual GameObject CreateEffect(EffectID name, float time) { //空オブジェ作成 GameObject effectObj; //エフェクト番号に変換 int effectNum = (int)name; //エフェクトをリストから複製 effectObj = Instantiate(_effects[effectNum]); //親の設定 SetParent(effectObj, name); //自己破壊セット SetDestroy(effectObj, time); return(effectObj); }
public static bool InitParams(EffectID effectID, LocatedEntity creature, object source, InvokeMode invokeMode, ref EffectExt refExt) { if (refExt == null) { refExt = new EffectExt(); } refExt.ReqParams = EffectsData.dbEffects[(int)effectID].ReqParams; ICheckProc proc = EffectsData.dbEffectProcs[(int)effectID].Check; if (proc != null) { proc.Invoke(effectID, (NWCreature)creature, source, invokeMode, refExt); } return(refExt.Valid); }
public void Make(EffectID effectID, Vector2 pos, int size, float interval, int loop) { List <Sprite> imageList = _imageList[(int)effectID].List; GameObject effectPrefab = (GameObject)Resources.Load("Prefabs/EffectObject"); GameObject effect = (GameObject)Instantiate(effectPrefab); Effect effectScript = effect.GetComponent <Effect>(); effectScript.SetPos(pos); effectScript.SetSize(size); effectScript.SetInterval(interval); effectScript.SetImageList(imageList); effectScript.SetMax(imageList.Count); effectScript.SetLoop(loop); effect.transform.SetParent(_parentGameObject.transform); }
public void Execute() { try { for (int i = Count - 1; i >= 0; i--) { Effect eff = GetItem(i); eff.Execute(); if (eff.Action != EffectAction.ea_Instant) { if (eff.Duration > 0) { int oldDuration = eff.Duration; EffectID eid = (EffectID)eff.CLSID; EffectFlags flags = EffectsData.dbEffects[(int)eid].Flags; if (flags.Contains(EffectFlags.ep_Decrease)) { eff.Duration--; } else if (flags.Contains(EffectFlags.ep_Increase)) { eff.Duration++; } eff.Magnitude = (int)Math.Round((float)eff.Magnitude * ((float)eff.Duration / (float)oldDuration)); if (eff.Source == null && eff.Duration == 0) { // e_Prowling has change effects list, // so we need check current effect // its hack and bad code! if (GetItem(i) == eff) { Delete(i); } } } } } } catch (Exception ex) { Logger.Write("EffectsList.execute(): " + ex.Message); } }
//エフェクト生成(親指定) public virtual GameObject CreateEffect(EffectID name, GameObject parent) { //空オブジェ作成 GameObject effectObj; //エフェクト番号に変換 int effectNum = (int)name; //エフェクトをリストから複製 effectObj = Instantiate(_effects[effectNum]); //親の設定 SetParent(effectObj, name, parent); //エフェクトの位置設定 effectObj.transform.position = parent.transform.position; //自己破壊セット SetDestroy(effectObj); return(effectObj); }
//エフェクト生成(対象エフェクト,親指定,オフセット指定,生存時間設定) public virtual GameObject CreateEffect(EffectID name, GameObject parent, Vector3 offSet, float time) { //空オブジェ作成 GameObject effectObj; //エフェクト番号に変換 int effectNum = (int)name; //エフェクトをリストから複製 effectObj = Instantiate(_effects[effectNum]); //親の設定 SetParent(effectObj, name, parent); //オフセット分位置をずらす effectObj.transform.position = parent.transform.position + offSet; //自動破壊セット SetDestroy(effectObj); return(effectObj); }
//親の設定(子供になるオブジェクト,セットするエフェクトID,親になるオブジェクト) public virtual void SetParent(GameObject obj, EffectID name, GameObject parent) { //エフェクトがRectTransform仕様でなければ if (name.Rect() == false) { //指定した親の子供にする obj.transform.SetParent(parent.transform); //ヒエラルキーの一番上に置く obj.transform.SetAsFirstSibling(); } else { //UIRootに置く obj.transform.SetParent(InGameManager.Instance.UIRoot.gameObject.transform); //ヒエラルキーの一番上に置く(最背面描画) obj.transform.SetAsFirstSibling(); } }
//エフェクト生成(作るだけ,位置指定) public virtual GameObject CreateEffect(EffectID name, Vector3 pos) { //空オブジェ作成 GameObject effectObj; //エフェクト番号に変換 int effectNum = (int)name; //エフェクトをリストから複製 effectObj = Instantiate(_effects[effectNum]); effectObj.SetActive(false); //親の設定 SetParent(effectObj, name); //エフェクトの位置設定 effectObj.transform.position = pos; //自己破壊セット SetDestroy(effectObj); effectObj.SetActive(true); return(effectObj); }
public static int GetDuration(EffectID effectID, ItemState state, bool Inv) { if (Inv) { if (state != ItemState.is_Blessed) { if (state == ItemState.is_Cursed) { state = ItemState.is_Blessed; } } else { state = ItemState.is_Cursed; } } MNXRange r = EffectsData.dbEffects[(int)effectID].Duration; float f = StaticData.dbItemStates[(int)state].Factor; return(RandomHelper.GetBoundedRnd((int)((long)Math.Round(((double)r.Min * (double)f))), (int)((long)Math.Round(((double)r.Max * (double)f))))); }
//親の設定(子供になるオブジェクト,セットするエフェクトID) public virtual void SetParent(GameObject obj, EffectID name) { //エフェクトがRectTransform仕様でなければ if (name.Rect() == false) { //エフェクト置き場に置く if (_effectPlace) { obj.transform.SetParent(_effectPlace.transform); //ヒエラルキーの一番上に置く obj.transform.SetAsFirstSibling(); } } else { //UIRootに置く obj.transform.SetParent(InGameManager.Instance.UIRoot.gameObject.transform); //ヒエラルキーの一番上に置く(最背面描画) obj.transform.SetAsFirstSibling(); } }
public override int RemoveEffect(EffectID eid) { int num = effects[eid.Priority].RemoveAll(node => node.ID == eid); count -= num; return num; }
public MapEffect(GameSpace space, object owner, EffectID eID, object source, EffectAction actionKind, int duration, int magnitude) : base(space, owner, eID, source, actionKind, duration, magnitude) { Ext = null; }
protected void OnStopAnimation(EffectID animation) { if (onStopAnimation != null) { onStopAnimation(animation); } }
public void Stop(EffectID animationID) { KillAnimationJob(); //D.Warn("No Animation named {0} to stop.", animation.GetName()); // Commented out as most show Jobs not yet implemented }
public void Start(EffectID animationID) { ShowAnimation(animationID); }
public void ShowAnimation(EffectID animation) { switch (animation) { case EffectID.Dying: ShowDying(); break; case EffectID.Hit: ShowHit(); break; case EffectID.Attacking: ShowAttacking(); break; case EffectID.CmdHit: ShowCmdHit(); break; case EffectID.Disbanding: ShowDisbanding(); break; case EffectID.Refitting: ShowRefitting(); break; case EffectID.Repairing: ShowRepairing(); break; case EffectID.None: default: throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(animation)); } }
public override int RemoveEffect(EffectID eid) { EffectRemoveListener(); #if DEBUG NotSupported.Throw("Non-Effect Property"); #endif return 0; }
public static int GetMagnitude(EffectID effectID) { MNXRange r = EffectsData.dbEffects[(int)effectID].Magnitude; return(RandomHelper.GetBoundedRnd(r.Min, r.Max)); }
public override int RemoveEffect(EffectID eid) { int num = effectList.RemoveEffect(eid); Invalidate(); return num; }
public void StopAnimation(EffectID animation) { if (_showingJob != null && _showingJob.IsRunning) { _showingJob.Kill(); } }
public void Exec(NWCreature creature, EffectID effectID, InvokeMode invokeMode, EffectExt ext, string rayMsg) { GlobalVars.nwrWin.ShowText(creature, rayMsg); int i = Effect.GetMagnitude(effectID); EffectTarget target = EffectTarget.et_None; if ((ext.ReqParams.Contains(EffectParams.ep_Direction))) { target = EffectTarget.et_Direction; } else { if ((ext.ReqParams.Contains(EffectParams.ep_Creature))) { target = EffectTarget.et_Creature; } } int x; int y; int x2; int y2; if (target != EffectTarget.et_Direction) { if (target != EffectTarget.et_Creature) { return; } x = creature.PosX; y = creature.PosY; NWCreature extCr = (NWCreature)ext.GetParam(EffectParams.ep_Creature); x2 = extCr.PosX; y2 = extCr.PosY; int dir = Directions.GetDirByCoords(x, y, x2, y2); x += Directions.Data[dir].DX; y += Directions.Data[dir].DY; } else { int dir = (int)ext.GetParam(EffectParams.ep_Direction); x = creature.PosX + Directions.Data[dir].DX; y = creature.PosY + Directions.Data[dir].DY; x2 = x + Directions.Data[dir].DX * i; y2 = y + Directions.Data[dir].DY * i; } Creature = creature; Dir = Directions.GetDirByCoords(x, y, x2, y2); EffID = effectID; Field = Creature.CurrentField; int eid = (int)effectID; EffectRec effRec = EffectsData.dbEffects[eid]; if (effRec.FrameCount > 0) { MapObject = new MapObject(creature.Space, Field); MapObject.InitByEffect(effectID); Field.Features.Add(MapObject); } else { MapObject = null; } TargetMeeted = AuxUtils.DoLine(x, y, x2, y2, LineProc, true); if (MapObject != null) { Field.Features.Remove(MapObject); } }
public abstract int RemoveEffect(EffectID eid);