public void CheckSnapping(MapEditorInSceneObject inSceneObj)
    {
        if (!GotSnappedObject)
        {
            if (inSceneObj.inSceneObjectType == IN_SCENE_OBJECT_TYPES.ORIGIN_POINT_WHITE || inSceneObj.inSceneObjectType == IN_SCENE_OBJECT_TYPES.ORIGIN_POINT_RED ||
                inSceneObj.inSceneObjectType == IN_SCENE_OBJECT_TYPES.ORIGIN_POINT_YELLOW || inSceneObj.inSceneObjectType == IN_SCENE_OBJECT_TYPES.ORIGIN_POINT_BLUE || inSceneObj.inSceneObjectType == IN_SCENE_OBJECT_TYPES.DESTINATION_POINT_WHITE ||
                inSceneObj.inSceneObjectType == IN_SCENE_OBJECT_TYPES.DESTINATION_POINT_RED || inSceneObj.inSceneObjectType == IN_SCENE_OBJECT_TYPES.DESTINATION_POINT_YELLOW ||
                inSceneObj.inSceneObjectType == IN_SCENE_OBJECT_TYPES.DESTINATION_POINT_BLUE)
            {
                if (!inSceneObj.SnappedTargetBox)
                {
                    GotSnappedObject = true;

                    inSceneObj.SnappedTargetBox            = this;
                    inSceneObj.InSceneObjData.mapGridIndex = transform.GetComponentInParent <MapGridMapEditor>().MapGridIndex;
                }
                else
                {
                    GotSnappedObject = true;
                    inSceneObj.SnappedTargetBox.GotSnappedObject = false;

                    inSceneObj.SnappedTargetBox            = this;
                    inSceneObj.InSceneObjData.mapGridIndex = transform.GetComponentInParent <MapGridMapEditor>().MapGridIndex;
                }
            }
        }
    }
Пример #2
0
    //------------------------------ BUTTON ACTIONS ------------------------------//

    private void ObjectCreatorButtonAction()
    {
        if (!MapEditorInputManager.Instance.OptionMenuVisibility)
        {
            MapEditorInSceneObject sceneObject = Instantiate(mapEditorInSceneObjectPrefab, new Vector3(-0.5f, -3.7f, 0.0f), mapEditorInSceneObjectPrefab.transform.rotation);
            MapEditorInputManager.Instance.SelectObject(sceneObject);
        }
    }
Пример #3
0
    public void CheckSnapping(MapEditorInSceneObject inSceneObj)
    {
        if (!GotSnappedObject)
        {
            IN_SCENE_OBJECT_TYPES objType = inSceneObj.inSceneObjectType;
            bool isVerticalLine           = objType == IN_SCENE_OBJECT_TYPES.NORMAL_VERTICAL_LINE || objType == IN_SCENE_OBJECT_TYPES.WHITE_VERTICAL_LINE || objType == IN_SCENE_OBJECT_TYPES.RED_VERTICAL_LINE ||
                                            objType == IN_SCENE_OBJECT_TYPES.YELLOW_VERTICAL_LINE || objType == IN_SCENE_OBJECT_TYPES.BLUE_VERTICAL_LINE;
            bool isHorizontalLine = objType == IN_SCENE_OBJECT_TYPES.NORMAL_HORIZONTAL_LINE || objType == IN_SCENE_OBJECT_TYPES.WHITE_HORIZONTAL_LINE || objType == IN_SCENE_OBJECT_TYPES.RED_HORIZONTAL_LINE ||
                                    objType == IN_SCENE_OBJECT_TYPES.YELLOW_HORIZONTAL_LINE || objType == IN_SCENE_OBJECT_TYPES.BLUE_HORIZONTAL_LINE;
            if (borderType == SNAPPING_TYPE.VERTICAL && isVerticalLine)
            {
                if (!inSceneObj.SnappedTargetBorder)
                {
                    GotSnappedObject = true;

                    inSceneObj.SnappedTargetBorder         = this;
                    inSceneObj.InSceneObjData.mapGridIndex = transform.GetComponentInParent <MapGridMapEditor>().MapGridIndex;
                    inSceneObj.InSceneObjData.borderDir    = snappingDir;
                }
                else
                {
                    inSceneObj.SnappedTargetBorder.GotSnappedObject = false;
                    GotSnappedObject = true;

                    inSceneObj.SnappedTargetBorder         = this;
                    inSceneObj.InSceneObjData.mapGridIndex = transform.GetComponentInParent <MapGridMapEditor>().MapGridIndex;
                    inSceneObj.InSceneObjData.borderDir    = snappingDir;
                }
            }
            else if (borderType == SNAPPING_TYPE.HORIZONTAL && isHorizontalLine)
            {
                if (!inSceneObj.SnappedTargetBorder)
                {
                    GotSnappedObject = true;

                    inSceneObj.SnappedTargetBorder         = this;
                    inSceneObj.InSceneObjData.mapGridIndex = transform.GetComponentInParent <MapGridMapEditor>().MapGridIndex;
                    inSceneObj.InSceneObjData.borderDir    = snappingDir;
                }
                else
                {
                    inSceneObj.SnappedTargetBorder.GotSnappedObject = false;
                    GotSnappedObject = true;

                    inSceneObj.SnappedTargetBorder         = this;
                    inSceneObj.InSceneObjData.mapGridIndex = transform.GetComponentInParent <MapGridMapEditor>().MapGridIndex;
                    inSceneObj.InSceneObjData.borderDir    = snappingDir;
                }
            }
        }
    }
Пример #4
0
    public void CheckSnapping(MapEditorInSceneObject inSceneObj)
    {
        if (!GotSnappedObject)
        {
            IN_SCENE_OBJECT_TYPES objType = inSceneObj.inSceneObjectType;
            bool isVerticalPortal         = objType == IN_SCENE_OBJECT_TYPES.PORTAL_1ST_SET_VERTICAL || objType == IN_SCENE_OBJECT_TYPES.PORTAL_2ND_SET_VERTICAL;
            bool isHorizontalPortal       = objType == IN_SCENE_OBJECT_TYPES.PORTAL_1ST_SET_HORIZONTAL || objType == IN_SCENE_OBJECT_TYPES.PORTAL_2ND_SET_HORIZONTAL;
            if (portalSnappingType == SNAPPING_TYPE.VERTICAL && isVerticalPortal)
            {
                if (!inSceneObj.SnappedTargetPortalSnapper)
                {
                    GotSnappedObject = true;

                    inSceneObj.SnappedTargetPortalSnapper  = this;
                    inSceneObj.InSceneObjData.mapGridIndex = transform.GetComponentInParent <MapGridMapEditor>().MapGridIndex;
                    inSceneObj.InSceneObjData.borderDir    = snappingDir;
                }
                else
                {
                    inSceneObj.SnappedTargetPortalSnapper.GotSnappedObject = false;
                    GotSnappedObject = true;

                    inSceneObj.SnappedTargetPortalSnapper  = this;
                    inSceneObj.InSceneObjData.mapGridIndex = transform.GetComponentInParent <MapGridMapEditor>().MapGridIndex;
                    inSceneObj.InSceneObjData.borderDir    = snappingDir;
                }
            }
            else if (portalSnappingType == SNAPPING_TYPE.HORIZONTAL && isHorizontalPortal)
            {
                if (!inSceneObj.SnappedTargetPortalSnapper)
                {
                    GotSnappedObject = true;

                    inSceneObj.SnappedTargetPortalSnapper  = this;
                    inSceneObj.InSceneObjData.mapGridIndex = transform.GetComponentInParent <MapGridMapEditor>().MapGridIndex;
                    inSceneObj.InSceneObjData.borderDir    = snappingDir;
                }
                else
                {
                    inSceneObj.SnappedTargetPortalSnapper.GotSnappedObject = false;
                    GotSnappedObject = true;

                    inSceneObj.SnappedTargetPortalSnapper  = this;
                    inSceneObj.InSceneObjData.mapGridIndex = transform.GetComponentInParent <MapGridMapEditor>().MapGridIndex;
                    inSceneObj.InSceneObjData.borderDir    = snappingDir;
                }
            }
        }
    }
Пример #5
0
 public void DeleteObject()
 {
     if (selectingObject.SnappedTargetBorder)
     {
         selectingObject.SnappedTargetBorder.GotSnappedObject = false;
     }
     if (selectingObject.SnappedTargetBox)
     {
         selectingObject.SnappedTargetBox.GotSnappedObject = false;
     }
     if (selectingObject.SnappedTargetPortalSnapper)
     {
         selectingObject.SnappedTargetPortalSnapper.GotSnappedObject = false;
     }
     Destroy(selectingObject.gameObject);
     selectingObject = null;
     SwitchInputMode(INPUT_MODE.NONE);
 }
Пример #6
0
    //------------------------------ INPUT MANAGER FUNCTIONS ------------------------------//

    private void SwitchInputMode(INPUT_MODE inputMode)
    {
        CurrentInputMode = inputMode;
        switch (CurrentInputMode)
        {
        case INPUT_MODE.NONE:
            if (selectingObject)
            {
                selectingObject.ChangeColor(selectingObject.defaultColor);
                selectingObject.UpdateInSceneObjectData();
                selectingObject.RemoveGizmo();
            }
            selectingObject = null;
            break;

        case INPUT_MODE.SELECTING:
            selectingObject.CreateGizmo(CurrentGizmoMode);
            break;
        }
    }
Пример #7
0
 public void SelectObject(MapEditorInSceneObject selectedObj)
 {
     selectedObj.ChangeColor(selectedObj.selectedColor);
     selectingObject = selectedObj;
     SwitchInputMode(INPUT_MODE.SELECTING);
 }
Пример #8
0
 public void AssignInSceneObject(MapEditorInSceneObject inSceneObj)
 {
     attachedInSceneObj = inSceneObj;
 }