Ejemplo n.º 1
0
    public void CancelPlacingGameObject()
    {
        if (electricCollisionHandler != null)
        {
            electricCollisionHandler.GetComponent <Collider>().isTrigger = true;
            PlayerManager.electricNetworkManager.ClearPreviewNetworkEdges();
        }

        UnlinkFootprintColliderHandlerToModelDyerMaterialChanging();
        PlayerManager.ResetInteractionState();
        Destroy(gameObjectToBePlaced);
        modelDyer = null;
    }
Ejemplo n.º 2
0
    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;
    }
Ejemplo n.º 3
0
    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();
    }