public Centipede_list(ref GameObject _body_c, ref GameObject _head_c) { list = null; aux = null; body_c = _body_c; head_c = _head_c; }
public Centipede_body(Centipede_body _prev, GameObject _body, Centipede_body _next, bool dH=true, bool dV=true) { prev = _prev; body = _body; next = _next; cDirH = dH; cDirV = dV; }
public Centipede_body() { prev = null; body = null; next = null; cDirH = true; cDirV = true; }
public void Centipede_init(GameObject dst) { float dx=30; float dy=-196.1f; int numNodes = 5; aux = null; for(int i=0; i<numNodes; i++) { list = new Centipede_body(); ///aux.set_next(ref ); list.Set_next(ref aux); GameObject bd;// = new GameObject("centip_"+i); if(list.Get_next()==null) { headCentip = list; bd = (GameObject)Instantiate(head_c, new Vector3(dx,0,dy), Quaternion.identity); bd.name = "centip_head"; }else{ bd = (GameObject)Instantiate(body_c, new Vector3(dx,0,dy), Quaternion.identity); list.Get_next().Set_prev(ref list); bd.name = "centip_0"; } //bd.name = "centip_"+i; bd.transform.Rotate(0,180,0); bd.transform.parent = dst.transform; //Debug.Log(bd.transform.localPosition); list.Set_body(bd); aux = list; dx -= 5.3f; } Debug.Log("++++++++++++++++++"); }
public void Set_next(ref Centipede_body a){ next = a; }
public void Set_prev(ref Centipede_body a){ prev = a; }