private static List <buttle> CreateA(int count, BullteType _type) { List <buttle> list = new List <buttle>(); for (int i = 0; i < count; i++) { GameObject A = GameObject.CreatePrimitive(PrimitiveType.Sphere); A.transform.Rotate(new Vector3(90, 0, 0)); A.transform.localScale = new Vector3(0.009f, 0.01f, 0.01f); buttle but = A.AddComponent <buttle>(); but.type = _type; list.Add(but); } return(list); }
// string ButtleType; public static List <buttle> CreateButtle(BullteType type, int count) { List <buttle> list = null; switch (type) { case BullteType.A: list = CreateA(count, type); break; case BullteType.B: list = CreateB(count, type); break; } return(list); }
//获得没使用的子弹 炸弹 private BulletBomEffect GetBullteBom(BullteType bt) { List <BulletBomEffect> tplist; BulletBomEffect zd; if (listZidan.ContainsKey(bt)) { tplist = listZidan[bt]; } else { tplist = new List <BulletBomEffect>(); listZidan.Add(bt, tplist); } zd = tplist.FirstOrDefault(e => !e.isShoot); if (zd == null) { Transform md = null; Vector3 scal = Vector3.zero; if (bt == BullteType.Bullte) { scal = Vector3.one * 1.5f; md = zidan; } else { scal = Vector3.one * 2; md = bom; } GameObject go = CommTool.InstantiateObj(md.gameObject, md.parent.gameObject, Vector3.zero, scal, tplist.Count.ToString()); zd = new BulletBomEffect(go); tplist.Add(zd); listZidan[bt] = tplist; } return(zd); }