Beispiel #1
0
    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;
    }
Beispiel #2
0
 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;
 }
Beispiel #3
0
    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);
    }