示例#1
0
        public GameObject SpawnNewScenery(SceneryTypeEnum sceneryTypeEnum)
        {
            appStateManager.SetAnchorAndContainerIfNull();
            GameObject sceneryObject = null;

            switch (sceneryTypeEnum)
            {
            case SceneryTypeEnum.Tree_TypeOne:
                sceneryObject = Instantiate(generalConfiguration.sceneryItemTreeTypeOnePrefab) as GameObject;
                break;

            case SceneryTypeEnum.Tree_TypeTwo:
                sceneryObject = Instantiate(generalConfiguration.sceneryItemTreeTypeTwoPrefab) as GameObject;
                break;

            default:
                sceneryObject = Instantiate(generalConfiguration.sceneryItemTreeTypeOnePrefab) as GameObject;
                break;
            }

            sceneryObject.AddComponent <Scenery>().sceneryTypeEnum = sceneryTypeEnum;
            sceneryObject.transform.parent = appStateManager.currentSceneryContainer.transform;

            return(sceneryObject);
        }
    private void SelectTouchedScenery(GameObject tappedSceneryObject)
    {
        appStateManager.SetAnchorAndContainerIfNull();

        foreach (Transform item in appStateManager.currentSceneryContainer.transform)
        {
            GameObject currentSceneryItemObject = item.gameObject;
            Scenery    currentSceneryItem       = currentSceneryItemObject.GetComponent <Scenery>();

            currentSceneryItem.isSelected = false; // set defaults
            currentSceneryItem.isMoving   = false;

            if (tappedSceneryObject.GetInstanceID() == currentSceneryItemObject.GetInstanceID())
            {
                currentSceneryItem.isSelected        = true;
                appStateManager.currentUIState       = UIStateEnum.SceneryButtonsOnly_ScenerySelected;
                appStateManager.currentOutputMessage = $"Selected Scenery. Next, use 'Move Scenery' button, or, tap anywhere else in the view to deselect scenery.";
            }
        }
    }
示例#3
0
    private SceneryItemContainerDTO MapSceneryGameobjectsToDTO()
    {
        SceneryItemContainerDTO sceneryItemContainer = new SceneryItemContainerDTO();

        appStateManager.SetAnchorAndContainerIfNull();

        foreach (Transform item in appStateManager.currentSceneryContainer.transform)
        {
            GameObject currentSceneryItemObject = item.gameObject;
            Scenery    currentSceneryItem       = currentSceneryItemObject.GetComponent <Scenery>();

            SceneryItemDTO sceneryItemDTO = new SceneryItemDTO();

            sceneryItemDTO.sceneryTypeEnum           = currentSceneryItem.sceneryTypeEnum;
            sceneryItemDTO.sceneryTransformComponent = new TransformComponentDTO(currentSceneryItemObject.transform);

            sceneryItemContainer.sceneryItems.Add(sceneryItemDTO);
        }
        return(sceneryItemContainer);
    }