Exemplo n.º 1
0
    public static EntityPickerGUI BehaviorTargetPicker(GameObject guiGameObject, VoxelArrayEditor voxelArray,
                                                       Entity self, Action <EntityBehavior.BehaviorTargetProperty> handler)
    {
        EntityPickerGUI entityPicker = guiGameObject.AddComponent <EntityPickerGUI>();

        entityPicker.voxelArray    = voxelArray;
        entityPicker.allowNone     = true;
        entityPicker.allowMultiple = false;
        entityPicker.allowNull     = true;
        entityPicker.nullName      = "Activators";
        entityPicker.handler       = (ICollection <Entity> entities) =>
        {
            entityPicker = null;
            foreach (Entity entity in entities)
            {
                if (entity == null) // activator
                {
                    handler(new EntityBehavior.BehaviorTargetProperty(new EntityReference(null), true));
                }
                else if (entity == self)
                {
                    handler(new EntityBehavior.BehaviorTargetProperty(new EntityReference(null), false));
                }
                else
                {
                    handler(new EntityBehavior.BehaviorTargetProperty(new EntityReference(entity), false));
                }
                return;
            }
            handler(new EntityBehavior.BehaviorTargetProperty(new EntityReference(null), false));
        };
        return(entityPicker);
    }
Exemplo n.º 2
0
    public override void Start(VoxelArrayEditor voxelArray, GameObject guiGameObject, TouchListener touchListener)
    {
        var fade = guiGameObject.AddComponent <FadeGUI>();

        fade.background      = image;
        fade.backgroundScale = scale;
    }
Exemplo n.º 3
0
    protected override ObjectMarker CreateObjectMarker(VoxelArrayEditor voxelArray)
    {
        GameObject markerObject = Resources.Load <GameObject>("ObjectMarkers/Player");

        markerObject = GameObject.Instantiate(markerObject);
        return(markerObject.AddComponent <ObjectMarker>());
    }
Exemplo n.º 4
0
 public void InitObjectMarker(VoxelArrayEditor voxelArray)
 {
     marker = CreateObjectMarker(voxelArray);
     marker.transform.parent = voxelArray.transform;
     marker.objectEntity     = this;
     marker.tag = "ObjectMarker";
 }
Exemplo n.º 5
0
    public override void Awake()
    {
        base.Awake();

        if (instance == null)
        {
            instance = this;
        }
        Voxel.selectedMaterial  = selectedMaterial;
        Voxel.xRayMaterial      = xRayMaterial;
        Voxel.highlightMaterial = highlightMaterial;

        ClearSelection();
        selectionChanged = false;
    }
Exemplo n.º 6
0
    private float successTime; // for success animation

    public static void StartTutorial(TutorialPageFactory[] tutorial,
                                     GameObject guiGameObject, VoxelArrayEditor voxelArray, TouchListener touchListener)
    {
        currentTutorial = tutorial;

        // voxelArray is null if opening a tutorial from menu
        if (voxelArray != null)
        {
            var tutorialGUI = guiGameObject.GetComponent <TutorialGUI>();
            if (tutorialGUI == null)
            {
                tutorialGUI = guiGameObject.AddComponent <TutorialGUI>();
            }
            tutorialGUI.voxelArray    = voxelArray;
            tutorialGUI.touchListener = touchListener;
            tutorialGUI.SetPage(0);
        }
        else
        {
            pageI = 0;
            // create the page when editScene is opened
            resetPageFlag = true;
        }
    }
Exemplo n.º 7
0
 public override void End(VoxelArrayEditor voxelArray, GameObject guiGameObject, TouchListener touchListener)
 {
     GameObject.Destroy(guiGameObject.GetComponent <FadeGUI>());
 }
Exemplo n.º 8
0
 public virtual void End(VoxelArrayEditor voxelArray, GameObject guiGameObject,
                         TouchListener touchListener)
 {
 }
Exemplo n.º 9
0
 public virtual TutorialAction Update(VoxelArrayEditor voxelArray, GameObject guiGameObject,
                                      TouchListener touchListener)
 {
     return(TutorialAction.NONE);
 }
Exemplo n.º 10
0
    protected override ObjectMarker CreateObjectMarker(VoxelArrayEditor voxelArray)
    {
        GameObject markerObject = ObjectTemplate(voxelArray);

        return(markerObject.AddComponent <ObjectMarker>());
    }
Exemplo n.º 11
0
 protected abstract ObjectMarker CreateObjectMarker(VoxelArrayEditor voxelArray);