public static Gaze_GazeCondition CreateGazeCondition(this S_InteractionDefinition _def,
                                                             string _objectToGazeGUID, Gaze_HoverStates _hoveState, Gaze_GazeConstraints _constraints)
        {
            bool gazeIn = _hoveState == Gaze_HoverStates.IN;

            return(_def.CreateCondition <Gaze_GazeCondition>(_objectToGazeGUID, gazeIn, _constraints));
        }
    public static CA_ARKit_Instantiate CreateArkitInstantiateAction(this S_InteractionDefinition _def,
                                                                    Gaze_ArkitPlaceConstraints _constraints, float _heigthOffset, float _distanceFromCamera, bool _chooseRandom, bool finite, int numReloads, List <GameObject> _prefabs, List <GameObject> _ghosts)
    {
        CA_ARKit_Instantiate action = _def.CreateAction <CA_ARKit_Instantiate>(_constraints, _heigthOffset,
                                                                               _distanceFromCamera, _chooseRandom, finite, numReloads, _prefabs, _ghosts);

        return(action);
    }
Esempio n. 3
0
    private void GenerateBehaivour()
    {
        if (HasEmptyObjects(objectsToPlace, this))
        {
            return;
        }

        S_IODefinition ioDef = SpatialStoriesAPI.CreateIODefinition(behaviourName);

        int counter = objectsToPlace.Count;

        S_InteractionDefinition start = ioDef.CreateInteractionDefinition(string.Concat("Start ", behaviourName));
        S_InteractionDefinition place = ioDef.CreateInteractionDefinition(string.Concat("Instantiate ", behaviourName));

        place.CreateArkitInstantiateAction((Gaze_ArkitPlaceConstraints)constraintsIndex, heightOffset, distanceFromCamera, ChooseMode.RANDOM == (ChooseMode)chooseModeIndex, NumInstantiatiations.FINITE == (NumInstantiatiations)numInstantiationsIndex, numObjectsToInstantiate, objectsToPlace, objectsToPlaceCursor);
        place.CreateDependency(start.GUID);

        place.CreateTouchCondition();
        S_InteractionDefinition end = null;

        if (numInstantiationsIndex == (int)NumInstantiatiations.FINITE)
        {
            end       = ioDef.CreateInteractionDefinition(string.Concat("End ", behaviourName));
            end.Delay = 0.03f;
        }

        if (constraintsIndex == (int)Gaze_ArkitPlaceConstraints.OVER_A_PLANE)
        {
            place.CreateGazeCondition(ioDef.GUID, Gaze_HoverStates.IN, Gaze_GazeConstraints.PLANE);
        }
        else if (constraintsIndex == (int)Gaze_ArkitPlaceConstraints.OVER_AN_OBJECT)
        {
            place.CreateGazeCondition(ioDef.GUID, Gaze_HoverStates.IN, Gaze_GazeConstraints.ANY_OBJECT);
        }
        else if (constraintsIndex == (int)Gaze_ArkitPlaceConstraints.OVER_AN_IMAGE)
        {
            place.CreateGazeCondition(ioDef.GUID, Gaze_HoverStates.IN, Gaze_GazeConstraints.IMAGE);
        }


        Gaze_InteractiveObject obj = SpatialStoriesAPI.CreateInteractiveObject(ioDef, false);

        SpatialStoriesAPI.WirePendingDependencies();

        // Set the trigger counter condition
        if (numInstantiationsIndex == (int)NumInstantiatiations.FINITE)
        {
            CC_CountTriggers c = SpatialStoriesAPI.GetObjectOfTypeWithGUID(end.GUID).gameObject.AddComponent <CC_CountTriggers>();
            c.NumTimes    = numObjectsToInstantiate;
            c.Interaction = SpatialStoriesAPI.GetObjectOfTypeWithGUID(place.GUID).GetComponent <Gaze_Conditions>();
            Gaze_Conditions conditions = c.GetComponent <Gaze_Conditions>();
            conditions.customConditionsEnabled = true;
            conditions.customConditions.Add(c);
        }

        Close();
    }
 public static CA_ARKitMove CreateArkitMoveAction(this S_InteractionDefinition _def, GameObject _objectToMove,
                                                  Gaze_ArkitPlaceConstraints _constraints, float _heigthOffset, float _distanceFromCamera, bool _dectivateAtStart)
 {
     return(_def.CreateAction <CA_ARKitMove>(_objectToMove, _constraints, _heigthOffset, _distanceFromCamera, _dectivateAtStart));
 }
Esempio n. 5
0
 public static CA_ShowPlaceCursor CreateArkitPlaceCursorAction(this S_InteractionDefinition _def,
                                                               GameObject _cursorPrefab, Gaze_ArkitPlaceConstraints _constraints, float _heigthOffset, float _distanceFromCamera)
 {
     return(_def.CreateAction <CA_ShowPlaceCursor>(_cursorPrefab, _constraints, _heigthOffset, _distanceFromCamera));
 }
Esempio n. 6
0
 public static Gaze_Dependency CreateDependency(this S_InteractionDefinition _def, string _dependentGUID)
 {
     return(_def.CreateCondition <Gaze_Dependency>(_dependentGUID));
 }
    private void GenerateBehaivour()
    {
        if (Behaviour_ObjectInstantiator.HasEmptyObjects(objectsToPlace, this))
        {
            return;
        }

        S_IODefinition ioDef = SpatialStoriesAPI.CreateIODefinition(behaviourName);

        int counter = objectsToPlace.Count;

        S_InteractionDefinition start = ioDef.CreateInteractionDefinition(string.Concat("Start ", behaviourName));
        string guidLastInteraction    = start.GUID;

        for (int i = counter - 1; i >= 0; i--)
        {
            GameObject objectToPlace = objectsToPlace[i];
            if (objectToPlace != null)
            {
                GameObject cursor = objectsToPlaceCursor[i];
                if (cursor != null)
                {
                    S_InteractionDefinition cursorDef = ioDef.CreateInteractionDefinition(string.Concat("Enable Cursor ", objectToPlace.name));
                    cursorDef.CreateDependency(guidLastInteraction);
                    cursorDef.CreateArkitPlaceCursorAction(cursor, (Gaze_ArkitPlaceConstraints)constraintsIndex, heightOffset, distanceFromCamera);
                    guidLastInteraction = cursorDef.GUID;
                }

                S_InteractionDefinition placeObjectDef = ioDef.CreateInteractionDefinition(string.Concat("Place ", objectToPlace.name));
                placeObjectDef.CreateTouchCondition();

                if (constraintsIndex == (int)Gaze_ArkitPlaceConstraints.OVER_A_PLANE)
                {
                    placeObjectDef.CreateGazeCondition(ioDef.GUID, Gaze_HoverStates.IN, Gaze_GazeConstraints.PLANE);
                }
                else if (constraintsIndex == (int)Gaze_ArkitPlaceConstraints.OVER_AN_OBJECT)
                {
                    placeObjectDef.CreateGazeCondition(ioDef.GUID, Gaze_HoverStates.IN, Gaze_GazeConstraints.ANY_OBJECT);
                }

                placeObjectDef.CreateArkitMoveAction(objectToPlace, (Gaze_ArkitPlaceConstraints)constraintsIndex, heightOffset, distanceFromCamera, deactivateAtStart);

                placeObjectDef.CreateDependency(guidLastInteraction);

                // Check if we need to place a cursor
                if (cursor != null)
                {
                    S_InteractionDefinition cursorDeactivateDef = ioDef.CreateInteractionDefinition(string.Concat("Disable Cursor ", objectToPlace.name));
                    cursorDeactivateDef.CreateDependency(placeObjectDef.GUID);
                    cursorDeactivateDef.CreateArkitHidePlaceCursor(guidLastInteraction);
                    guidLastInteraction = cursorDeactivateDef.GUID;
                }
                else
                {
                    guidLastInteraction = placeObjectDef.GUID;
                }
            }
        }
        S_InteractionDefinition end = ioDef.CreateInteractionDefinition(string.Concat("End ", behaviourName));

        end.Delay = 0.03f;
        end.CreateDependency(guidLastInteraction);

        SpatialStoriesAPI.CreateInteractiveObject(ioDef, false);
        SpatialStoriesAPI.WirePendingDependencies();
    }
 /// <summary>
 /// Creates a touch condition definition setup as Touch Everywhere
 /// </summary>
 /// <param name="_def"></param>
 /// <returns></returns>
 public static Gaze_ARKitScreenTouchCondition CreateTouchCondition(this S_InteractionDefinition _def)
 {
     return(_def.CreateCondition <Gaze_ARKitScreenTouchCondition>(null, false));
 }
 /// <summary>
 /// Helper method to create a touch condition with the SpatialStoriesAPI
 /// </summary>
 /// <param name="_objectToTouchGUID">Object to touch</param>
 /// <param name="_touchIO">Touch on object or everywhere on the screen ?</param>
 /// <returns></returns>
 public static Gaze_ARKitScreenTouchCondition CreateTouchCondition(this S_InteractionDefinition _def,
                                                                   string _objectToTouchGUID, bool _touchIO)
 {
     return(_def.CreateCondition <Gaze_ARKitScreenTouchCondition>(_objectToTouchGUID, _touchIO));
 }
 public static CA_HidePlaceCursor CreateArkitHidePlaceCursor(this S_InteractionDefinition _def,
                                                             string _showCursorInteractionGUID)
 {
     return(_def.CreateAction <CA_HidePlaceCursor>(_showCursorInteractionGUID));
 }