void AddSnakeCube() { float cubeOffset = config.cubeSize; float scale = config.cubeSize; CubePos cp = snakeCubes [snakeCubes.Count - 1].GetCubePos(); float moveTime = 0.9f * config.moveInterval; SnakeCube sc = Instantiate(snakeCube) as SnakeCube; sc.transform.localScale = new Vector3(scale, scale, scale); sc.transform.parent = GameObject.Find("BasePoint").transform; sc.transform.localPosition = cp.ToVec3(); sc.SetMovePara(cubeOffset, moveTime); sc.SetCubePos(cp); // Debug.Log ("-----" + cp.x.ToString() + " " + cp.y.ToString() + " "+ cp.z.ToString() + " "); cubePosEmpty [cp.GetIndex()] = false; sc.SetNextSnakeCube(snakeCubes[snakeCubes.Count - 1]); //sc.PreMove (); snakeCubes.Add(sc); }
public void SetCubePos(CubePos cp) { cubePos = cp; transform.localPosition = cp.ToVec3(); }
public Vector3 GetCurrentDirection() { return(deltaCubePos.ToVec3()); }