public void InitializeHullSection(Color innerHullColor, Color outerHullColor) { if (GetComponentInParent <ShipCell>().hasCellNeighborAt.Contains(sectionOrder - 1)) { isInnerHull = true; } mF = GetComponent <MeshFilter>(); mR = GetComponent <MeshRenderer>(); mH.SetMeshOffset(meshOffset); mH.AssignHullMeshData(sectionOrder, isInnerHull); mH.ReturnCompleteMesh(mF); mR.material.shader = Shader.Find("Unlit/Color"); if (isInnerHull) { mR.material.color = innerHullColor; } else { mR.material.color = outerHullColor; } GetComponentInParent <ShipCell>().hullSectionObjs[sectionOrder - 1] = gameObject; }
public void InitializeCellHub() { mF = GetComponent <MeshFilter>(); mR = GetComponent <MeshRenderer>(); mH.SetMeshOffset(meshOffset); mH.AssignHexMeshData(); mH.ReturnCompleteMesh(mF); mR.material.shader = Shader.Find("Unlit/Color"); mR.material.color = GlobalData.hubColor; }
void BuildShipsSpaceMesh(MeshFilter shipFilter) { List <Vector3> outerHullVertices = new List <Vector3>(); List <Vector3> outerVertexDirections = new List <Vector3> (); RetrieveOuterHullVertices(outerHullVertices, outerVertexDirections); MeshHandler mH = new MeshHandler(); mH.AssignOuterHullMeshData(outerHullVertices, outerVertexDirections, hullHeight, shellDepth, shellInset); mH.ReturnCompleteMesh(shipFilter); }
public void InitializeCellSection(Color sectionColor, Color innerHullColor, Color outerHullColor) { mF = GetComponent <MeshFilter>(); mR = GetComponent <MeshRenderer>(); mH.SetMeshOffset(meshOffset); mH.AssignSectionMeshData(sectionOrder); mH.ReturnCompleteMesh(mF); mR.material.shader = Shader.Find("Unlit/Color"); mR.material.color = sectionColor; hullSection = new GameObject(); GetComponentInParent <ShipCell>().hullSectionObjs[sectionOrder - 1] = hullSection; hullSection.transform.SetParent(transform); hullSection.AddComponent <MeshFilter>(); hullSection.AddComponent <MeshRenderer>(); hullSection.AddComponent <HullSection>(); hullSection.GetComponent <HullSection>().SetSectionOrder(sectionOrder); hullSection.GetComponent <HullSection>().SetMeshOffset(meshOffset); hullSection.GetComponent <HullSection>().InitializeHullSection(innerHullColor, outerHullColor); hullSection.gameObject.name = "Hull " + (sectionOrder); }