Skip to content
Snippets Groups Projects
Commit 55e13abd authored by Paul-Walcher's avatar Paul-Walcher
Browse files

Added Spawn Method for Cylinder

parent 97c5dd7e
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,8 @@ public GameObject
Sphere,
ActualSphere,
Cuboid,
TriangularPrism
TriangularPrism,
Cylinder
;
private void OnEnable()
......@@ -79,6 +80,8 @@ public void SpawnFactRepresentation(Fact fact)
SpawnCuboid(cuboidFact); break;
case PrismFact prismFact:
SpawnTriangularPrism(prismFact); break;
case CylinderFact cylinderFact:
SpawnCylinderFact(cylinderFact); break;
default: break;
};
}
......@@ -95,6 +98,18 @@ public void SpawnCuboid(CuboidFact fact){
cuboid.GetComponentInChildren<TextMeshPro>().text = fact.GetLabel(StageStatic.stage.factState) + " = " + System.Math.Round(fact.Volume, 2) + "m³";
}
public void SpawnCylinderFact(CylinderFact fact){
GameObject cylinder = GameObject.Instantiate(Cylinder);
fact.WorldRepresentation = cylinder.GetComponent<FactObject3D>();
fact.WorldRepresentation.Fact = fact;
cylinder.transform.SetPositionAndRotation(fact.Position, fact.Rotation);
cylinder.transform.localScale = Vector3.Scale(cylinder.transform.localScale, fact.LocalScale);
cylinder.GetComponentInChildren<TextMeshPro>().text = fact.GetLabel(StageStatic.stage.factState) + " = " + System.Math.Round(fact.Volume, 2) + "m³";
}
public void SpawnSphere(SphereFact fact){
GameObject sphere = GameObject.Instantiate(ActualSphere);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment