public void LoadAnimation2() { Vector2[] positionArr = { new Vector2(-737, 1143), new Vector2(-709, 996), new Vector2(-429, 996), new Vector2(-296, 914), new Vector2(-238, 1013), new Vector2(-395, 1112), new Vector2(-614, 1232), new Vector2(-601, 1105), new Vector2(-952, 1105), new Vector2(-442, 931), new Vector2(-675, 948), new Vector2(-354, 1080), new Vector2(-553, 1024), }; _spineFansList2.Clear(); for (int i = 0; i < 8; i++) { int rand = Random.Range(0, _spineIdArray.Length); VisitFansSpineItem item = CreateSpine(_spineIdArray[rand], "01_dai_ji"); int rand2 = Random.Range(0, positionArr.Length); item.GetComponent <RectTransform>().anchoredPosition = positionArr[rand2]; _spineFansList2.Add(item); _spineAllFansList.Add(item); } }
/// <summary> /// 广场上的粉丝动画 /// </summary> /// <param name="moreFans"></param> public void LoadAnimation(bool moreFans) { CanvasGroup cg = _spineContainer.GetComponent <CanvasGroup>(); cg.alpha = 0; cg.DOFade(1, 0.3f); Vector2[] positionArr = { new Vector2(-190, 383), //挥手 new Vector2(-54, 363), //站 翻转 new Vector2(-173,-128), //挥手 new Vector2(-12, -150), //挥手 翻转 new Vector2(-90, -285), //站 new Vector2(-107, 645), //挥手 new Vector2(400, 371), //站 new Vector2(314, 921), //左右不停翻转 7 new Vector2(423, 167), //站 new Vector2(-326,-603), //来回走 index=9 new Vector2(-70, -454), new Vector2(-473, 906), //来回走 index=11 new Vector2(144, 839), new Vector2(-264, 159), //来回走 index=13 new Vector2(144, 184), }; string[] animationArr = { "03_hui_shou", "01_dai_ji", "03_hui_shou", "03_hui_shou", "01_dai_ji", "03_hui_shou", "01_dai_ji", "01_dai_ji", //左右不停翻转 "01_dai_ji", "02_zou_lu", "02_zou_lu", "02_zou_lu", "02_zou_lu", "02_zou_lu", "02_zou_lu", }; bool[] reversalArr = { false, true, false, true, false, false, false, true, false, false, false, false, false, false, }; List <string> spineIdList = new List <string>(); int index = Random.Range(0, _spineIdArray.Length); spineIdList.Add(_spineIdArray[index]); spineIdList.AddRange(GetUnequalAnimationNames(2)); spineIdList.AddRange(GetUnequalAnimationNames(3)); for (int i = 6; i < positionArr.Length; i++) { index = Random.Range(0, _spineIdArray.Length); spineIdList.Add(_spineIdArray[index]); } _spineFansList.Clear(); _spineAllFansList.Clear(); for (int i = 0; i < 12; i++) // for (int i = 0; i < spineIdList.Count - 1; i++) { if (i == 10 || i == 12) { continue; } if (moreFans == false) { if (i == 2 || i == 3 || i == 5 || i == 6 || i == 11) { continue; } } Vector3 offset = new Vector3(Random.Range(-250, 250), Random.Range(-250, 250), 0 ); VisitFansSpineItem item = CreateSpine(spineIdList[i], "01_dai_ji"); item.GetComponent <RectTransform>().anchoredPosition = _paths[0] + offset; _spineFansList.Add(item); _spineAllFansList.Add(item); } }