IEnumerator onAniEffect(float effDelay, AniDataEffect ade, string aniDataId, int shotPointIndex, string aniId) { yield return(new WaitForSeconds(effDelay)); #if UNITY_EDITOR if (UnitSkillCamMaker.instance.useEffectSkillCamEditor) { if (ade.useThis == false) { yield break; } } #endif if (_isEnabled) { switch (ade.shotPoint) { case AniDataEffect.PointType.ShotPoint: GameManager.info.effectData[ade.id].getEffect(stat.uniqueId, Monster.setShootingHand(this), stat.uniqueId, this, null, null, ade.timeLimit); break; case AniDataEffect.PointType.CustomPoint: GameObject cpGo = GameManager.info.effectData[ade.id].getEffect(stat.uniqueId, Monster.setShootingHandWithCustomValue(this, ade.x, ade.y, ade.z), stat.uniqueId, this, null, null, ade.timeLimit); if (cpGo != null) { if (ade.useCustomRotation) { _v.x = ade.rx; _v.y = ade.ry; _v.z = ade.rz; } else { _v.x = 0.0f; _v.y = 0.0f; _v.z = 0.0f; } _q.eulerAngles = _v; cpGo.transform.localRotation = _q; } break; case AniDataEffect.PointType.CustomBullet: GameObject cbGo = GameManager.info.effectData[ade.id].getEffect(stat.uniqueId, Monster.setShootingHandWithCustomValue(this, ade.x, ade.y, ade.z), stat.uniqueId, this, null, null, ade.timeLimit); if (cbGo != null) { if (ade.useCustomRotation) { _v.x = ade.rx; _v.z = ade.rz; if (isPlayerSide) { _v.y = 90.0f + ade.ry; } else { _v.y = 270.0f + ade.ry; } } else { _v.x = 0.0f; _v.z = 0.0f; if (isPlayerSide) { _v.y = 90.0f; } else { _v.y = 270.0f; } } _q.eulerAngles = _v; cbGo.transform.localRotation = _q; } break; case AniDataEffect.PointType.Target: if (target != null) { GameObject tgo = GameManager.info.effectData[ade.id].getEffect(stat.uniqueId, target.cTransformPosition, stat.uniqueId, this, null, null, ade.timeLimit); if (tgo != null) { _q = tgo.transform.localRotation; _v = _q.eulerAngles; _v.x = 0.0f; _v.y = 90.0f; _v.z = 0.0f; _q.eulerAngles = _v; tgo.transform.localRotation = _q; } } else if (effectTargetPosition.y > -500) { GameObject tgo2 = GameManager.info.effectData[ade.id].getEffect(stat.uniqueId, effectTargetPosition, stat.uniqueId, this, null, null, ade.timeLimit); if (tgo2 != null) { _q = tgo2.transform.localRotation; _v = _q.eulerAngles; _v.x = 0.0f; _v.y = 90.0f; _v.z = 0.0f; _q.eulerAngles = _v; tgo2.transform.localRotation = _q; } } else { GameManager.info.effectData[ade.id].getEffect(stat.uniqueId, Monster.setShootingHandWithCustomValue(this, ade.x, ade.y, ade.z), stat.uniqueId, this, null, null, ade.timeLimit); } break; case AniDataEffect.PointType.AttachedShotPoint: GameManager.info.effectData[ade.id].getEffect(stat.uniqueId, Monster.setShootingHandWithCustomValueWithoutMonsterPosition(this, ade.x, ade.y, ade.z), stat.uniqueId, this, getShootHand(aniId, shotPointIndex), null, ade.timeLimit, true); break; case AniDataEffect.PointType.AttachedTransform: if (effectParents != null && ade.parent != null && effectParents.ContainsKey(ade.parent)) { GameObject goAt = GameManager.info.effectData[ade.id].getEffect(stat.uniqueId, Monster.setShootingHandWithCustomValueWithoutMonsterPosition(this, ade.x, ade.y, ade.z), stat.uniqueId, this, effectParents[ade.parent], null, ade.timeLimit, true); if (goAt != null) { if (ade.useCustomRotation) { _v.x = ade.rx; _v.y = ade.ry; _v.z = ade.rz; } else { _v.x = 0.0f; _v.y = 0.0f; _v.z = 0.0f; } _q.eulerAngles = _v; goAt.transform.localRotation = _q; } } break; default: GameManager.info.effectData[ade.id].getEffect(stat.uniqueId, cTransform.position, stat.uniqueId, this, null, null, ade.timeLimit); break; } } }
public void setData(string[] f) { string[] d = new string[17]; for (int i = 0; i < d.Length; ++i) { d[i] = string.Empty; } for (int i = 0; i < f.Length && i < d.Length; ++i) { d[i] = f[i]; } id = d[3]; ani = d[4]; link = d[5]; link = link.Trim(); if (string.IsNullOrEmpty(d[6])) { link = null; } if (ani.Contains("atk") || ani.Contains("sk_")) { delay = Util.stringToFloatArray((d[7]), ','); delayLength = delay.Length; for (int i = 0; i < delayLength; ++i) { delay[i] = delay[i] / 30.0f; } } // UnityEngine.Debug.Log(id); string temp = d[8]; if (temp.Length > 1) { string[] e = temp.Split('/'); effectNum = e.Length; effect = new AniDataEffect[effectNum]; for (int i = 0; i < effectNum; ++i) { effect[i] = new AniDataEffect(); string[] tte = e[i].Split('@'); if (tte.Length == 2) { effect[i].parent = tte[1]; } string[] te = tte[0].Split(','); effect[i].id = te[0]; effect[i].delay = ((float)Convert.ToInt32(te[1])) / 30.0f; effect[i].attachedToCharacter = false; switch (te[2]) { case "S": effect[i].shotPoint = AniDataEffect.PointType.ShotPoint; if (te.Length >= 7) { effect[i].timeLimit = ((float)Convert.ToDouble(te[6])); } break; case "C": effect[i].shotPoint = AniDataEffect.PointType.CustomPoint; effect[i].x = ((float)Convert.ToInt32(te[3])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].y = ((float)Convert.ToInt32(te[4])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].z = ((float)Convert.ToInt32(te[5])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; if (te.Length >= 7) { effect[i].timeLimit = ((float)Convert.ToDouble(te[6])); } if (te.Length >= 10) { effect[i].useCustomRotation = true; effect[i].rx = ((float)Convert.ToInt32(te[7])); effect[i].ry = ((float)Convert.ToInt32(te[8])); effect[i].rz = ((float)Convert.ToInt32(te[9])); } break; case "CB": effect[i].shotPoint = AniDataEffect.PointType.CustomBullet; effect[i].x = ((float)Convert.ToInt32(te[3])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].y = ((float)Convert.ToInt32(te[4])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].z = ((float)Convert.ToInt32(te[5])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; if (te.Length >= 7) { effect[i].timeLimit = ((float)Convert.ToDouble(te[6])); } if (te.Length >= 10) { effect[i].useCustomRotation = true; effect[i].rx = ((float)Convert.ToInt32(te[7])); effect[i].ry = ((float)Convert.ToInt32(te[8])); effect[i].rz = ((float)Convert.ToInt32(te[9])); } break; case "T": effect[i].shotPoint = AniDataEffect.PointType.Target; effect[i].x = ((float)Convert.ToInt32(te[3])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].y = ((float)Convert.ToInt32(te[4])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].z = ((float)Convert.ToInt32(te[5])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; if (te.Length >= 7) { effect[i].timeLimit = ((float)Convert.ToDouble(te[6])); } if (te.Length >= 10) { effect[i].useCustomRotation = true; effect[i].rx = ((float)Convert.ToInt32(te[7])); effect[i].ry = ((float)Convert.ToInt32(te[8])); effect[i].rz = ((float)Convert.ToInt32(te[9])); } break; case "AS": effect[i].shotPoint = AniDataEffect.PointType.AttachedShotPoint; effect[i].x = ((float)Convert.ToInt32(te[3])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].y = ((float)Convert.ToInt32(te[4])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].z = ((float)Convert.ToInt32(te[5])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; if (te.Length >= 7) { effect[i].timeLimit = ((float)Convert.ToDouble(te[6])); } if (te.Length >= 10) { effect[i].useCustomRotation = true; effect[i].rx = ((float)Convert.ToInt32(te[7])); effect[i].ry = ((float)Convert.ToInt32(te[8])); effect[i].rz = ((float)Convert.ToInt32(te[9])); } break; case "AT": effect[i].shotPoint = AniDataEffect.PointType.AttachedTransform; effect[i].x = ((float)Convert.ToInt32(te[3])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].y = ((float)Convert.ToInt32(te[4])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].z = ((float)Convert.ToInt32(te[5])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; if (te.Length >= 7) { effect[i].timeLimit = ((float)Convert.ToDouble(te[6])); } if (te.Length >= 10) { effect[i].useCustomRotation = true; effect[i].rx = ((float)Convert.ToInt32(te[7])); effect[i].ry = ((float)Convert.ToInt32(te[8])); effect[i].rz = ((float)Convert.ToInt32(te[9])); } break; default: effect[i].shotPoint = AniDataEffect.PointType.Character; break; } if (effect[i].timeLimit <= 0.01f) { effect[i].timeLimit = 10000; } } } else { effectNum = 0; } temp = d[10]; if (temp.Length > 1) { string[] c = temp.Split('/'); camEffectNum = c.Length; camEffect = new AniDataCamEffect[camEffectNum]; for (int i = 0; i < camEffectNum; ++i) { camEffect[i] = new AniDataCamEffect(); string[] ce = c[i].Split(','); switch (ce[0]) { case "E": camEffect[i].type = AniDataCamEffect.Type.Quake; break; } camEffect[i].delay = ((float)Convert.ToInt32(ce[1])) / 30.0f; camEffect[i].optionValue = 0.0f; //(float)Convert.ToDouble(ce[2]); camEffect[i].optionValue2 = 0.0f; //(float)Convert.(ce[3]); float.TryParse(ce[2], out camEffect[i].optionValue); float.TryParse(ce[3], out camEffect[i].optionValue2); } } else { camEffectNum = 0; } string tempS = d[11]; if (string.IsNullOrEmpty(tempS) == false) { string[] ts = tempS.Split('/'); soundNum = ts.Length; sound = new AniDataSound[soundNum]; for (int i = 0; i < soundNum; ++i) { sound[i] = new AniDataSound(); string[] tts = ts[i].Split(','); sound[i].id = tts[0]; float.TryParse(tts[1], out sound[i].delay); sound[i].delay /= 30.0f; } } else { soundNum = 0; } temp = d[13]; temp = temp.Trim(); // UnityEngine.Debug.Log(id); if (string.IsNullOrEmpty(temp) == false) { string[] tmp = temp.Split('/'); shootingPointLength = tmp.Length; shootingPositions = new int[tmp.Length][]; for (int i = 0; i < shootingPointLength; ++i) { shootingPositions[i] = Util.stringToIntArray(tmp[i], ','); // shootingPositions[i][0] = (int)((float)shootingPositions[i][0] * ((float)GameManager.info.modelData[id].scale)/100.0f); // shootingPositions[i][1] = (int)((float)shootingPositions[i][1] * ((float)GameManager.info.modelData[id].scale)/100.0f); // shootingPositions[i][2] = (int)((float)shootingPositions[i][2] * ((float)GameManager.info.modelData[id].scale)/100.0f); shootingPositions[i][0] = Mathf.FloorToInt((float)shootingPositions[i][0] * ((float)GameManager.info.modelData[id].scale) / 100.0f); shootingPositions[i][1] = Mathf.FloorToInt((float)shootingPositions[i][1] * ((float)GameManager.info.modelData[id].scale) / 100.0f); shootingPositions[i][2] = Mathf.FloorToInt((float)shootingPositions[i][2] * ((float)GameManager.info.modelData[id].scale) / 100.0f); } //shootingPoint = temp.Split(','); //shootingPointLength = shootingPoint.Length; } temp = d[14]; temp = temp.Trim(); if (string.IsNullOrEmpty(temp) == false) { shootingPoint = temp.Split(','); shootingHandLength = shootingPoint.Length; } Util.parseObject(d[15], out hitRange, true, 0.0f); // UnityEngine.Debug.Log(id); hitRange *= ((((float)GameManager.info.modelData[id].scale) / 100.0f)); // Util.parseObject(d[16],out aniLength, true, -1000); }
public static int sortByFrame(AniDataEffect x, AniDataEffect y) { return(x.frame.CompareTo(y.frame)); }
public void setData(List <object> l, Dictionary <string, int> k) { id = (string)l[k["ID"]]; ani = (string)l[k["ANI"]]; link = (string)l[k["LINK"]]; link = link.Trim(); // UnityEngine.Debug.Log(id); if (string.IsNullOrEmpty(link)) { link = null; } if (ani.Contains("atk") || ani.Contains("sk_")) { delay = Util.stringToFloatArray((l[k["FRAME"]].ToString()), ','); delayLength = delay.Length; for (int i = 0; i < delayLength; ++i) { delay[i] = delay[i] / 30.0f; } } // UnityEngine.Debug.Log(id); string temp = (string)l[k["EFFECT"]]; if (temp.Length > 1) { string[] e = temp.Split('/'); effectNum = e.Length; effect = new AniDataEffect[effectNum]; for (int i = 0; i < effectNum; ++i) { effect[i] = new AniDataEffect(); string[] tte = e[i].Split('@'); if (tte.Length == 2) { effect[i].parent = tte[1]; Debug.Log("parent: " + tte[1]); } string[] te = tte[0].Split(','); effect[i].id = te[0]; effect[i].delay = ((float)Convert.ToInt32(te[1])) / 30.0f; effect[i].attachedToCharacter = false; switch (te[2]) { case "S": effect[i].shotPoint = AniDataEffect.PointType.ShotPoint; if (te.Length == 4) { effect[i].timeLimit = ((float)Convert.ToDouble(te[6])); } break; case "C": effect[i].shotPoint = AniDataEffect.PointType.CustomPoint; if (te.Length > 5) { effect[i].x = ((float)Convert.ToInt32(te[3])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].y = ((float)Convert.ToInt32(te[4])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].z = ((float)Convert.ToInt32(te[5])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; } else { effect[i].x = 0; effect[i].y = 0; effect[i].z = 0; } if (te.Length >= 7) { effect[i].timeLimit = ((float)Convert.ToDouble(te[6])); } if (te.Length >= 10) { effect[i].useCustomRotation = true; effect[i].rx = ((float)Convert.ToInt32(te[7])); effect[i].ry = ((float)Convert.ToInt32(te[8])); effect[i].rz = ((float)Convert.ToInt32(te[9])); } break; case "CB": effect[i].shotPoint = AniDataEffect.PointType.CustomBullet; if (te.Length > 5) { effect[i].x = ((float)Convert.ToInt32(te[3])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].y = ((float)Convert.ToInt32(te[4])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].z = ((float)Convert.ToInt32(te[5])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; } else { effect[i].x = 0; effect[i].y = 0; effect[i].z = 0; } if (te.Length >= 7) { effect[i].timeLimit = ((float)Convert.ToDouble(te[6])); } if (te.Length >= 10) { effect[i].useCustomRotation = true; effect[i].rx = ((float)Convert.ToInt32(te[7])); effect[i].ry = ((float)Convert.ToInt32(te[8])); effect[i].rz = ((float)Convert.ToInt32(te[9])); } break; case "T": effect[i].shotPoint = AniDataEffect.PointType.Target; if (te.Length > 5) { effect[i].x = ((float)Convert.ToInt32(te[3])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].y = ((float)Convert.ToInt32(te[4])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].z = ((float)Convert.ToInt32(te[5])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; } else { effect[i].x = 0; effect[i].y = 0; effect[i].z = 0; } if (te.Length >= 7) { effect[i].timeLimit = ((float)Convert.ToDouble(te[6])); } if (te.Length >= 10) { effect[i].useCustomRotation = true; effect[i].rx = ((float)Convert.ToInt32(te[7])); effect[i].ry = ((float)Convert.ToInt32(te[8])); effect[i].rz = ((float)Convert.ToInt32(te[9])); } break; case "AS": effect[i].shotPoint = AniDataEffect.PointType.AttachedShotPoint; if (te.Length > 5) { effect[i].x = ((float)Convert.ToInt32(te[3])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].y = ((float)Convert.ToInt32(te[4])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].z = ((float)Convert.ToInt32(te[5])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; } else { effect[i].x = 0; effect[i].y = 0; effect[i].z = 0; } if (te.Length >= 7) { effect[i].timeLimit = ((float)Convert.ToDouble(te[6])); } if (te.Length >= 10) { effect[i].useCustomRotation = true; effect[i].rx = ((float)Convert.ToInt32(te[7])); effect[i].ry = ((float)Convert.ToInt32(te[8])); effect[i].rz = ((float)Convert.ToInt32(te[9])); } break; case "AT": effect[i].shotPoint = AniDataEffect.PointType.AttachedTransform; if (te.Length > 5) { effect[i].x = ((float)Convert.ToInt32(te[3])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].y = ((float)Convert.ToInt32(te[4])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; effect[i].z = ((float)Convert.ToInt32(te[5])) * ((float)GameManager.info.modelData[id].scale) / 100.0f; } else { effect[i].x = 0; effect[i].y = 0; effect[i].z = 0; } if (te.Length >= 7) { effect[i].timeLimit = ((float)Convert.ToDouble(te[6])); } if (te.Length >= 10) { effect[i].useCustomRotation = true; effect[i].rx = ((float)Convert.ToInt32(te[7])); effect[i].ry = ((float)Convert.ToInt32(te[8])); effect[i].rz = ((float)Convert.ToInt32(te[9])); } break; default: effect[i].shotPoint = AniDataEffect.PointType.Character; break; } if (effect[i].timeLimit <= 0.01f) { effect[i].timeLimit = 10000; } } } else { effectNum = 0; } temp = (string)l[k["CAM"]]; if (temp.Length > 1) { string[] c = temp.Split('/'); camEffectNum = c.Length; camEffect = new AniDataCamEffect[camEffectNum]; for (int i = 0; i < camEffectNum; ++i) { camEffect[i] = new AniDataCamEffect(); string[] ce = c[i].Split(','); switch (ce[0]) { case "E": camEffect[i].type = AniDataCamEffect.Type.Quake; break; } camEffect[i].delay = ((float)Convert.ToInt32(ce[1])) / 30.0f; camEffect[i].optionValue = 0.0f; //(float)Convert.ToDouble(ce[2]); camEffect[i].optionValue2 = 0.0f; //(float)Convert.(ce[3]); float.TryParse(ce[2], out camEffect[i].optionValue); float.TryParse(ce[3], out camEffect[i].optionValue2); } } else { camEffectNum = 0; } string tempS = (string)l[k["SOUND"]]; if (string.IsNullOrEmpty(tempS) == false) { string[] ts = tempS.Split('/'); soundNum = ts.Length; sound = new AniDataSound[soundNum]; for (int i = 0; i < soundNum; ++i) { sound[i] = new AniDataSound(); string[] tts = ts[i].Split(','); sound[i].id = tts[0]; float.TryParse(tts[1], out sound[i].delay); sound[i].delay /= 30.0f; } } else { soundNum = 0; } temp = (string)l[k["SHOT_POS"]]; temp = temp.Trim(); // UnityEngine.Debug.Log(id); if (string.IsNullOrEmpty(temp) == false) { string[] tmp = temp.Split('/'); shootingPointLength = tmp.Length; shootingPositions = new int[tmp.Length][]; for (int i = 0; i < shootingPointLength; ++i) { shootingPositions[i] = Util.stringToIntArray(tmp[i], ','); shootingPositions[i][0] = (int)((float)shootingPositions[i][0] * ((float)GameManager.info.modelData[id].scale) / 100.0f); shootingPositions[i][1] = (int)((float)shootingPositions[i][1] * ((float)GameManager.info.modelData[id].scale) / 100.0f); shootingPositions[i][2] = (int)((float)shootingPositions[i][2] * ((float)GameManager.info.modelData[id].scale) / 100.0f); } //shootingPoint = temp.Split(','); //shootingPointLength = shootingPoint.Length; } temp = (string)l[k["SHOOTING_POINT"]]; temp = temp.Trim(); if (string.IsNullOrEmpty(temp) == false) { shootingPoint = temp.Split(','); shootingHandLength = shootingPoint.Length; } Util.parseObject(l[k["HIT_RANGE"]], out hitRange, true, 0.0f); #if UNITY_EDITOR if (GameManager.info.modelData.ContainsKey(id) == false) { UnityEngine.Debug.Log(id); } #endif hitRange *= ((((float)GameManager.info.modelData[id].scale) / 100.0f)); // Util.parseObject(l[k["LENGTH"]],out aniLength, true, -1000); }