Ejemplo n.º 1
0
    private void AISingleRandomSelection(SelectionTask selectionTask)
    {
        List <GameObject> tempSelectedObjects = new List <GameObject>();

        tempSelectedObjects.Add(selectObject.Randomly(selectionTask.objectsForSelection));
        EndAutoSelection(selectionTask, tempSelectedObjects);
    }
Ejemplo n.º 2
0
    private void AIOneGroupSelection(SelectionTask selectionTask)
    {
        List <GameObject> tempSelectedObjects = new List <GameObject>();

        tempSelectedObjects = selectObject.ByEntireGroup(selectionTask.objectsForSelection);
        EndAutoSelection(selectionTask, tempSelectedObjects);
    }
Ejemplo n.º 3
0
    private void SecondarySelection(SelectionTask selectionTask)
    {
        Vector2 dir = MultiInput.GetPrimaryDirection();

        curSecondarySelection = selectObject.ByDirection(selectionTask.objectsForSelection, dir, curSecondarySelection);
        if (MultiInput.GetAButtonDown())
        {
            List <GameObject> tempSelectedObjects = new List <GameObject>();
            tempSelectedObjects.Add(curSecondarySelection);
            EndManualSelection(selectionTask, tempSelectedObjects);
            secondaryCursor.SetActive(false);
        }
    }
Ejemplo n.º 4
0
 private void OneGroupSelection(SelectionTask selectionTask)
 {
     view.Highlight(selectionTask.objectsForSelection[genericSwitchIndx], secondaryCursor); //This switchs rapidly between to make a see through effect. we need to add see through sprites so that we dont have to do this
     genericSwitchIndx++;
     if (genericSwitchIndx >= selectionTask.objectsForSelection.Count)
     {
         genericSwitchIndx = 0;
     }
     if (MultiInput.GetAButtonDown())
     {
         List <GameObject> tempSelectedObjects = new List <GameObject>();
         tempSelectedObjects = selectObject.ByEntireGroup(selectionTask.objectsForSelection);
         EndManualSelection(selectionTask, tempSelectedObjects);
         secondaryCursor.SetActive(false);
     }
 }
Ejemplo n.º 5
0
    public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
    {
        JObject  jObject  = JObject.Load(reader);
        TaskType taskType = (TaskType)jObject.GetValue("taskTypes").Value <Int64>();

        Task task;

        if (taskType.HasFlag(TaskType.Selection))
        {
            task = new SelectionTask();
        }
        else
        {
            task = new ManipulationTask();
        }

        serializer.Populate(jObject.CreateReader(), task);

        return(task);
    }
Ejemplo n.º 6
0
 private void EndManualSelection(SelectionTask selectionTask, List <GameObject> tempSelectedObjects)
 {
     selectionTask.SelectionFinishedCallback(tempSelectedObjects);
     ManualSelectionTasks.Remove(selectionTask);
 }
Ejemplo n.º 7
0
    private void StartAutoSelection(SubAbility subAb, DelCurSelectionBehavior SelectionBehavior, List <GameObject> objectsForSelection)
    {
        SelectionTask selection = new SelectionTask(SelectionBehavior, objectsForSelection, subAb.OnSelectionFinished);

        AutoSelectionTasks.Add(selection);
    }
Ejemplo n.º 8
0
    /// <summary>
    /// Adds the current task to the json file.
    /// </summary>
    void AddCurrentTaskToFile()
    {
        currentTasks = File.Exists(targetFile) ? JsonHelper.DeserializeFromFile <List <Task> >(targetFile) : new List <Task>();

        if (currentTaskType == TaskType.None)
        {
            Debug.Log("Please generate task first!");
            return;
        }

        // determine the position where the new task should be added (so all tasks are grouped by there task type)
        int      index;
        TaskType lastTaskType = TaskType.None;

        for (index = 0; index < currentTasks.Count; index++)
        {
            if (currentTaskType == lastTaskType && currentTasks[index].taskTypes != lastTaskType)
            {
                break;
            }
            lastTaskType = currentTasks[index].taskTypes;
        }

        if (currentTaskType.HasFlag(TaskType.Selection))
        {
            SelectionTask taskToAdd = new SelectionTask
            {
                id              = GetId(),
                distance        = distance,
                actualDistance  = posDistances[distance - 1],
                radius          = radius,
                taskTypes       = currentTaskType,
                timeLimit       = timeLimit,
                taskObjects     = taskObjects,
                minDensity      = density,
                numberOfObjects = objectCount
            };
            currentTasks.Insert(index, taskToAdd);
        }
        else
        {
            ManipulationTask taskToAdd = new ManipulationTask
            {
                id                   = GetId(),
                distance             = distance,
                actualDistance       = posDistances[distance - 1],
                radius               = radius,
                taskTypes            = currentTaskType,
                timeLimit            = timeLimit,
                startObject          = taskObjects[0],
                endObject            = taskObjects[1],
                manipulationAmount   = manipulationAmount,
                neededDoFs           = neededDoFs,
                PositioningTolerance = positioningTolerance,
                RotatingTolerance    = rotatingTolerance,
                ScalingTolerance     = scalingTolerance
            };
            currentTasks.Insert(index, taskToAdd);
        }

        JsonHelper.SerializeToFile(targetFile, currentTasks);

        Debug.Log("Successfully added task to file.");
    }