Beispiel #1
0
//	void ShowPath(Vector3[] points){
//
//		//Debug.Log(Input.mousePosition);
//		//HexCell target = HexGrid.instance.GetCell(assist.WorldToGrid(point));
//		//HexCell start = HexGrid.instance.GetCell(player.transform.position);
//		//Debug.Log("Clicked "+ target.q+":"+target.r);
//		foreach (var item in markers) {
//			Destroy(item);
//		}
//		markers = new GameObject[points.Length];
//		for (int i = 0; i < points.Length; i++) {
//
//			markers[i] = SlapMarker(points[i]);
//			markers[i].name = "Hex mark";
//
//		}
//
//
//		//temp = waypoints[pathcount]-player.transform.position;
//		//tween =
//	}

    GameObject SlapMarker(Vector3 pos)
    {
        GameObject go = new GameObject("hex");
        MeshFilter mf = go.AddComponent <MeshFilter>();

        go.AddComponent <MeshRenderer>();
        mf.mesh = MeshGen.Hex(HexLayout.instance.wide_width);
        go.transform.localScale     = Vector3.one * 0.3f;
        go.transform.position       = pos;
        go.transform.parent         = field;
        go.transform.localRotation  = Quaternion.identity;
        go.transform.localPosition += Vector3.up * 0.02f;
        return(go);
    }