public void CancelPlacingGameObject() { if (electricCollisionHandler != null) { electricCollisionHandler.GetComponent <Collider>().isTrigger = true; PlayerManager.electricNetworkManager.ClearPreviewNetworkEdges(); } UnlinkFootprintColliderHandlerToModelDyerMaterialChanging(); PlayerManager.ResetInteractionState(); Destroy(gameObjectToBePlaced); modelDyer = null; }
public void CompletePlacingGameObject() { if (electricCollisionHandler != null) { ElectricNetworkConnector electricNetworkConnector = gameObjectToBePlaced.GetComponent <ElectricNetworkConnector>(); UnlinkElectricColliderFromCablePreview(); PlayerManager.electricNetworkManager.ClearPreviewNetworkEdges(); electricNetworkConnector.HandlePlacement(PlayerManager.electricNetworkManager, electricCollisionHandler); } UnlinkFootprintColliderHandlerToModelDyerMaterialChanging(); PlayerManager.ResetInteractionState(); modelDyer.ChangeMaterialsBackToInitial(); gameObjectToBePlaced = null; modelDyer = null; }
public void StartPlacingGameObject(GameObject gameObjectPrefab) { PlayerManager.ChangeInteractionStateTo(InteractionState.Placing); gameObjectToBePlaced = GameObject.Instantiate(gameObjectPrefab); modelDyer = gameObjectToBePlaced.GetComponent <ModelDyer>(); modelDyer.ChangeMaterialsToPositiveHover(); GameObject footprintCollider = PlayerManager.GetChildObject(gameObjectToBePlaced, "FootprintCollider"); footprintCollisionHandler = footprintCollider.GetComponent <CollisionHandler>(); LinkFootprintColliderHandlerToModelDyerMaterialChanging(); GameObject electricNetworkNodeCollider = PlayerManager.GetChildObject(gameObjectToBePlaced, "ElectricNetworkNodeCollider"); // If there is no ElectricNetworkNodeCollider attached to the gameObject if (electricNetworkNodeCollider == null) { return; } electricCollisionHandler = electricNetworkNodeCollider.GetComponent <CollisionHandler>(); LinkElectricColliderToCablePreview(); }