protected virtual void SetDBPos() { if (IsHasSetDB) { return; } IsHasSetDB = true; if (maps == null) { maps = GlobalTools.FindObjByName("maps"); } if (maps == null) { return; } //print("*******************************************跳跃地板"); string tiaoyuediban = "tiaoyueDBD_" + Globals.mapTypeNums; List <string> tiaoyuedibanDArr = GetDateByName.GetInstance().GetListByName(tiaoyuediban, MapNames.GetInstance()); GameObject dibanD = GlobalTools.GetGameObjectByName(tiaoyuedibanDArr[GlobalTools.GetRandomNum(tiaoyuedibanDArr.Count)]); float _x1 = tl.position.x + 5; float _x2 = rd.position.x - 5; float _x = _x1 + GlobalTools.GetRandomDistanceNums(Mathf.Abs(_x2 - _x1)); float _y = tl.position.y - 4 + GlobalTools.GetRandomDistanceNums(8); dibanD.transform.position = new Vector3(_x, _y, 0); dibanD.transform.parent = maps.transform; //if (IsPenSheZiDanJG) GetPenSheZiDanJG(); }
private void GetZYBJCaopi() { //throw new NotImplementedException(); int nums = 1 + GlobalTools.GetRandomNum(3); if (nums == 0) { return; } // 数组名字 ZYBJCaopi_1 string ListName = "ZYBJCaopi_1"; List <string> CaopiArr = GetDateByName.GetInstance().GetListByName(ListName, MapNames.GetInstance()); for (int i = 0; i < nums; i++) { string jingName = CaopiArr[GlobalTools.GetRandomNum(CaopiArr.Count)]; //print("-----------------> 啥啊 "+jingName); GameObject jing = GlobalTools.GetGameObjectByName(jingName); jing.transform.parent = maps.transform; float W = GlobalTools.GetJingW(jing); float __x = tl.position.x + W * 0.5f - 1 + GlobalTools.GetRandomDistanceNums((GetWidth() - W + 2)); float __y = tl.position.y - 2.5f + GlobalTools.GetRandomDistanceNums(0.5f); float __z = 2.5f + 0.4f * i; jing.GetComponent <SpriteRenderer>().sortingOrder = -30 - i % 3; jing.transform.position = new Vector3(__x, __y, __z); } }
//根据名字头 和 关卡 获取 景的list数据 public List <string> GetListByFstNameAndGKNums(string nameFst) { string strName = nameFst + GetGKNum(); print("????? " + strName); print("?obj " + GetDateByName.GetInstance().GetListByName(strName, ScreenDate.GetInstance())); return(GetDateByName.GetInstance().GetListByName(strName, ScreenDate.GetInstance())); }
VOAtk GetAtkVOByName(string _name, System.Object obj) { Dictionary <string, string> dic = GetDateByName.GetInstance().GetDicSSByName(_name, obj); atkvo = new VOAtk(); atkvo.GetVO(dic); return(atkvo); }
public void GetAtk(string atkName = null) { //print(" atkName " + atkName+" "+isAtking); if (roleDate.isBeHiting) { return; } if (isDodgeing) { return; } if (DBBody.animation.lastAnimationName == DOWNONGROUND) { return; } if (!isAtk) { isAtk = true; isAtking = true; isAtkYc = true; yanchi = 0; jisuqi = 0; if (isInAiring) { atkZS = DataZS.jumpAtkZS; } else { atkZS = DataZS.atkZS; } if (atkName == null) { vOAtk.GetVO(atkZS[(int)atkNums]); DBBody.animation.GotoAndPlayByFrame(vOAtk.atkName, 0, 1); } else { vOAtk.GetVO(GetDateByName.GetInstance().GetDicSSByName(atkName, DataZS.GetInstance())); DBBody.animation.GotoAndPlayByFrame(vOAtk.atkName, 0, 1); } MoveVX(vOAtk.xF); if (newSpeed.y < 0) { newSpeed.y = 1; playerRigidbody2D.velocity = newSpeed; MoveVY(vOAtk.yF); } //获取XY方向的推力 //print(DBBody.animation.animations); } }
void GetDBShuiMian() { if (ShuiMianDBNums == 0) { return; } List <string> db_shuimians = GetDateByName.GetInstance().GetListByName("db_shuimian_" + Globals.mapTypeNums.ToString(), MapNames.GetInstance()); //MapNames.GetInstance().GetCanRandomUSEJYGName("db_shuimian_"+ Globals.mapTypeNums.ToString()); //MapNames.GetInstance().db_shuimian+"_"+Globals.mapTypeNums.ToString(); if (db_shuimians.Count == 0) { return; } int duans = ShuiMianDBNums; //GameObject maps = GlobalTools if (ShuiMianDBNums == 100) { //=100的时候 根据 距离来生成 地板个数 int nums = (int)Mathf.Abs(thePos2.position.x - thePos1.position.x) / 10 - 2; if (nums < 0) { return; } duans = nums; } float _distances = Mathf.Abs(thePos2.position.x - thePos1.position.x) / duans; float __x = 0; float __y = 0; if (duans == 1) { _distances *= 0.5f; } for (int i = 0; i < duans; i++) { if (ShuiMianDBNums == 100 && i == duans - 1) { continue; } __x = thePos1.position.x + _distances * (i + 1) - 0.5f + GlobalTools.GetRandomDistanceNums(1); __y = thePos1.position.y - 1.9f; GameObject db_shuimian = GlobalTools.GetGameObjectByName(db_shuimians[GlobalTools.GetRandomNum(db_shuimians.Count)]); db_shuimian.transform.position = new Vector2(__x, __y); int _order = 6 + i % 6; GlobalTools.SetMapObjOrder(db_shuimian, _order); db_shuimian.transform.parent = maps.transform; } }
// 通过关卡 标记 获取 元素数组名 判断 是否有数组 public string GetJingArrNameByGKKey(string jingArrName) { //string JingArrName = jingArrName + "_" + GetGKKey(); string JingArrName = jingArrName; if (GetDateByName.GetInstance().GetListByName(JingArrName, MapNames.GetInstance()) == null) { JingArrName = ""; } return(JingArrName); }
public static GetDateByName GetInstance() { if (instance == null) { //GameObject go = new GameObject("GetDateByName"); //DontDestroyOnLoad(go); //instance = go.AddComponent<GetDateByName>(); instance = new GetDateByName(); } //instance = new GetDateByName(); return(instance); }
//生成 粒子雾 protected virtual void GetWus() { Vector2 pos1 = tl.position; Vector2 pos2 = new Vector2(rd.position.x, tl.position.y); //float _y = pos1.y - 1.5f; //SetJingByDistanceU("liziWu_1", nums, pos1, pos2, pos1.y+1, 0, 0, 0, "u"); Color color1 = new Color(0.1f, 1f, 1f, 0.1f); GetWu("", pos1, pos2, -30, color1); color1 = new Color(0.1f, 1f, 1f, 0.3f);// GlobalTools.RandomColor(); if (GlobalTools.GetRandomNum() < 20) { GetWu("qWu", pos1, pos2, 30, color1); } //获取背景的 上升渐变的 雾 //Color color2 = MapNames.GetInstance().GetColorByGKKey(); //new Color(0.1f, 1f, 1f, 0.3f); Color color2 = new Color(0.1f, 1f, 1f, 0.3f); GetWu("", pos1, pos2, -60, color2); if (!IsLiziWu) { return; } string liziArrName = MapNames.GetInstance().GetJingArrNameByGKKey("liziWu"); if (liziArrName == "") { return; } List <string> liziArr = GetDateByName.GetInstance().GetListByName(liziArrName, MapNames.GetInstance()); SetLiziByNums(1, liziArr, pos1.x, pos2.x, pos1.y - 1); if (GlobalTools.GetRandomNum() > 0) { liziArrName = MapNames.GetInstance().GetJingArrNameByGKKey("liziWu2"); if (liziArrName == "") { return; } liziArr = GetDateByName.GetInstance().GetListByName(liziArrName, MapNames.GetInstance()); SetLiziByNums(1, liziArr, pos1.x, pos2.x, pos1.y - 1); } }
public string GetCanRandomUSEJYGName(string listName) { string _listName = listName + "_" + Globals.mapTypeNums; //print("取怪的 列表名字 " + _listName); List <string> list = GetDateByName.GetInstance().GetListByName(_listName, MapNames.GetInstance()); if (list == null) { return(""); } //print(" list "+list.Count); return(list[GlobalTools.GetRandomNum(list.Count)]); }
protected GameObject GetJObjByListName(string jinglistName) { List <string> strArr = GetDateByName.GetInstance().GetListByName(jinglistName, MapNames.GetInstance()); string objName = strArr[GlobalTools.GetRandomNum(strArr.Count)]; GameObject jingObj = GlobalTools.GetGameObjectByName(objName); if (jingObj == null) { print("报空对象名 " + objName); } jingObj.transform.parent = maps.transform; return(jingObj); }
protected override void SetDBPos() { if (IsHasSetDB) { return; } IsHasSetDB = true; if (maps == null) { maps = GlobalTools.FindObjByName("maps"); } if (maps == null) { return; } //print("*******************************************跳跃地板"); string tiaoyuediban = "tiaoyueDBD_" + Globals.mapTypeNums; List <string> tiaoyuedibanDArr = GetDateByName.GetInstance().GetListByName(tiaoyuediban, MapNames.GetInstance()); GameObject dibanD = GlobalTools.GetGameObjectByName(tiaoyuedibanDArr[GlobalTools.GetRandomNum(tiaoyuedibanDArr.Count)]); float _x1 = tl.position.x + 5; float _x2 = rd.position.x - 5; float _x = _x1 + GlobalTools.GetRandomDistanceNums(Mathf.Abs(_x2 - _x1)); float _y = tl.position.y - 0.6f + GlobalTools.GetRandomDistanceNums(3); //判断 是单地板 还是双地板 DBNums = GlobalTools.GetRandomNum() > 50 ? 1 : 2; if (DBNums == 2) { _x = tl.position.x + GetWidth() * 0.33f; } dibanD.transform.position = new Vector3(_x, _y, 0); dibanD.transform.parent = maps.transform; if (DBNums == 2) { GameObject dibanD2 = GlobalTools.GetGameObjectByName(tiaoyuedibanDArr[GlobalTools.GetRandomNum(tiaoyuedibanDArr.Count)]); _x = _x = tl.position.x + GetWidth() * 0.66f; _y = tl.position.y - 1 + GlobalTools.GetRandomDistanceNums(3); dibanD2.transform.position = new Vector3(_x, _y, 0); dibanD2.transform.parent = maps.transform; } //if (IsPenSheZiDanJG) GetPenSheZiDanJG(); }
public override void GetAtk(string atkName = null) { if (roleDate.isBeHiting) { return; } if (isDodgeing || isAcing) { return; } //阻止了快落地攻击时候的bug //这里会导致AI回跳 进入落地动作而不能进入atk动作 所以回跳的跳起在动画里面做 不在程序里面给Y方向推力 if (DBBody.animation.lastAnimationName == DOWNONGROUND) { return; } if (!isAtk) { isAtk = true; isAtking = true; isTXShow = true; isAtkYc = true; yanchi = 0; jisuqi = 0; if (isInAiring) { atkZS = DataZS.jumpAtkZS; } else { atkZS = DataZS.atkZS; } if (atkName == null) { vOAtk.GetVO(atkZS[(int)atkNums]); DBBody.animation.GotoAndPlayByFrame(vOAtk.atkName, 0, 1); } else { //GetPause(0.5f,0.5f); string _atkName = atkName; if (atkName.Split('|').Length != 1) { _atkName = atkName.Split('|')[0]; float times = float.Parse(atkName.Split('|')[1].Split('-')[0]); float scales = 0.5f; if (atkName.Split('|')[1].Split('-').Length != 1) { scales = float.Parse(atkName.Split('|')[1].Split('-')[1]); } GetPause(times, scales); } vOAtk.GetVO(GetDateByName.GetInstance().GetDicSSByName(_atkName, DataZS.GetInstance())); DBBody.animation.GotoAndPlayByFrame(vOAtk.atkName, 0, 1); if (vOAtk.qishouYC != 0) { GetPause(vOAtk.qishouYC, 0.01f); } } MoveVX(vOAtk.xF, true); } }
protected override void GetWus() { Vector2 pos1 = tl.position; Vector2 pos2 = new Vector2(rd.position.x, rd.position.y + 1); //float _y = pos1.y - 1.5f; //SetJingByDistanceU("liziWu_1", nums, pos1, pos2, pos1.y+1, 0, 0, 0, "u"); //Color color1 = new Color(0.1f, 1f, 1f, 0.1f); //GetWu("", pos1, pos2, -30, color1); Color color2 = MapNames.GetInstance().GetColorByGKKey(); //new Color(0.1f, 1f, 1f, 0.3f); GetWu("", pos1, pos2, -70, color2); if (!IsLiziWu) { return; } string liziArrName = MapNames.GetInstance().GetJingArrNameByGKKey("liziWu"); if (liziArrName == "") { return; } List <string> liziArr = GetDateByName.GetInstance().GetListByName(liziArrName, MapNames.GetInstance()); if (ShuiMianDBNums == 1) { SetLiziByNums(2, liziArr, pos1.x, pos2.x, pos1.y - 1); } else if (ShuiMianDBNums == 100) { SetLiziByNums(10, liziArr, pos1.x, pos2.x, pos1.y - 1); } else { SetLiziByNums(1, liziArr, pos1.x, pos2.x, pos1.y - 1); } if (GlobalTools.GetRandomNum() > 0) { liziArrName = MapNames.GetInstance().GetJingArrNameByGKKey("liziWu2"); if (liziArrName == "") { return; } liziArr = GetDateByName.GetInstance().GetListByName(liziArrName, MapNames.GetInstance()); //SetLiziByNums(1, liziArr, pos1.x, pos2.x, pos1.y - 1); if (ShuiMianDBNums == 1) { SetLiziByNums(2, liziArr, pos1.x, pos2.x, pos1.y - 1); } else if (ShuiMianDBNums == 100) { SetLiziByNums(10, liziArr, pos1.x, pos2.x, pos1.y - 1); } else { SetLiziByNums(1, liziArr, pos1.x, pos2.x, pos1.y - 1); } } }
//_cx 朝向 xzds 旋转度数 protected virtual void SetJingByDistanceU(string jinglistName, int nums, Vector2 pos1, Vector2 pos2, float _y, float _z, float _dz, int sd, string _cx, float xzds = 0) { List <string> strArr = GetDateByName.GetInstance().GetListByName(jinglistName, MapNames.GetInstance()); string _jinglistNameTou = jinglistName.Split('_')[0]; //print(" ---------------------------------------------------------------------------- "+ _jinglistNameTou); for (int i = 0; i < nums; i++) { string objName = strArr[GlobalTools.GetRandomNum(strArr.Count)]; //print(" ----------------------------- 前景名字 "+ objName); GameObject jingObj = GlobalTools.GetGameObjectByName(objName); if (jingObj == null) { continue; } jingObj.transform.parent = maps.transform; //大于宽度的景 直接删除了 bool IsShu = false; if ((_jinglistNameTou != "ybj" && _jinglistNameTou != "ybj2") && _jinglistNameTou != "Shu") { if (IsDaYuDis(jingObj, pos1.x, pos2.x) && _jinglistNameTou != "zyj" && _jinglistNameTou != "dyj") { Destroy(jingObj); continue; } } else { IsShu = true; } bool IsLBSuoDuan = false; if (_jinglistNameTou == "yqj") { IsLBSuoDuan = true; } if (_jinglistNameTou == "ybj" || _jinglistNameTou == "ybj2") { //print(" *************************************************************************** ------>>>??? "+jingObj.name); float ___y = _y; if (_UpOrDown != GlobalMapDate.YIBAN && _UpOrDown != GlobalMapDate.BOSS_PINGDI && _UpOrDown != GlobalMapDate.JINGYING_PINGDI && _UpOrDown != GlobalMapDate.JUQING_PINGDI) { if (i == 0 || i == nums - 1) { ___y -= 4; } } GlobalTools.SetDaBeiJingTY(jingObj, pos1.x, pos2.x, _y, _z, _dz, i, nums, xzds, sd, false, IsShu, IsLBSuoDuan); continue; } //_y -= GlobalTools.GetRandomDistanceNums(0.2f); GlobalTools.SetJingTY(jingObj, pos1.x, pos2.x, _y, _z, _dz, i, nums, xzds, sd, false, IsShu, IsLBSuoDuan); } }