public void RequestFx(Transform senderT, int message) { // string key = Genkey(senderT.name, message); int key = message; AniEventType type; int p1, p2; SkillEventManager.SeperateID(message, out type, out p1, out p2); if (forPreviewParams.ContainsKey(key)) { FxCreateParams p = forPreviewParams[key]; Vector3 pos = senderT.TransformPoint(p.localPosition); Quaternion rot = senderT.rotation * Quaternion.Euler(p.localRotationEuler); FxCreateParams createPrams = forPreviewParams[message]; if (p.isAtt) { Vector3 targetLocalPosition; if (p.isFly){ targetLocalPosition = targetPosition; } else{ targetLocalPosition = new Vector3(targetPosition.x, 0, targetPosition.z); } FakeTarget target = targetManager.RequestTarget(senderT.TransformPoint(targetLocalPosition)); FakeBullet bullet = bulletParent.RequestBullet(); if (p.isFly) { bullet.FlyToTartget(pos, target.myT, 15, Hit ); bullet.transform.position = pos; bullet.transform.rotation = rot; } else { bullet.SetToPosition(target.myT.position, rot); } RequestFx(gfxIDToPool[p2], Vector3.zero, Quaternion.identity, bullet.myT); if (hitEffectIdBuffer.ContainsKey(bullet.myT)) { hitEffectIdBuffer[bullet.myT] = p.hitGfxID; } else { hitEffectIdBuffer.Add(bullet.myT, p.hitGfxID); } } else { RequestFx(gfxIDToPool[p2], senderT.TransformPoint(p.localPosition), senderT.rotation * Quaternion.Euler(p.localRotationEuler)); if (p.hitGfxID != -1) { DelayGfx delayGfx = new DelayGfx(); delayGfx.delay = meleeHitGfxDelay; delayGfx.pool = gfxIDToPool[p.hitGfxID]; delayGfx.position = senderT.TransformPoint(targetPosition); delayGfx.rotation = senderT.rotation * Quaternion.Euler(p.localRotationEuler); StartCoroutine(DelayHitGfx(delayGfx)); } } } else { Debug.LogWarning(string.Format("E: {0} key: {1} @ {2}", message, key, senderT.name)); } }
IEnumerator DelayHitGfx(DelayGfx delayGfx) { yield return new WaitForSeconds(delayGfx.delay); RequestFx(delayGfx.pool, delayGfx.position, delayGfx.rotation); }