Ejemplo n.º 1
0
    private void DoneHandler(Data data)
    {
        SceneItems.GetItem <CardManager>("CardManager").ReplaceAllowedList();

        gameObject.SetActive(false);
        SceneItems.GetItem("BoardSettings").SetActive(true);
    }
Ejemplo n.º 2
0
    private void Start()
    {
        type = EntityType.Player;

        actionPanel = SceneItems.GetItem("ActionPanel");
        EventManager.StartListening("EndTurnPressed", EndTurnHandler);
    }
Ejemplo n.º 3
0
        internal override void ExportToSTL(string path, string modelName)
        {
            var geoms = SceneItems.Where(i => i is DynamoGeometryModel3D).
                        Cast <DynamoGeometryModel3D>();

            using (TextWriter tw = new StreamWriter(path))
            {
                tw.WriteLine("solid {0}", model.CurrentWorkspace.Name);
                foreach (var g in geoms)
                {
                    var n = ((MeshGeometry3D)g.Geometry).Normals.ToList();
                    var t = ((MeshGeometry3D)g.Geometry).Triangles.ToList();

                    for (var i = 0; i < t.Count(); i++)
                    {
                        var nCount = i * 3;
                        tw.WriteLine("\tfacet normal {0} {1} {2}", n[nCount].X, n[nCount].Y, n[nCount].Z);
                        tw.WriteLine("\t\touter loop");
                        tw.WriteLine("\t\t\tvertex {0} {1} {2}", t[i].P0.X, t[i].P0.Y, t[i].P0.Z);
                        tw.WriteLine("\t\t\tvertex {0} {1} {2}", t[i].P1.X, t[i].P1.Y, t[i].P1.Z);
                        tw.WriteLine("\t\t\tvertex {0} {1} {2}", t[i].P2.X, t[i].P2.Y, t[i].P2.Z);
                        tw.WriteLine("\t\tendloop");
                        tw.WriteLine("\tendfacet");
                    }
                }
                tw.WriteLine("endsolid {0}", model.CurrentWorkspace.Name);
            }
        }
Ejemplo n.º 4
0
    private void Start()
    {
        tilePrefab = Resources.Load <GameObject>("Prefabs/TileButton");
        tilesPanel = SceneItems.GetItem <Transform>("TilePanel");

        Map.OperateOnTiles(LoadTile);
    }
Ejemplo n.º 5
0
 private void Start()
 {
     SceneItems.GetItem <TileWindow>("TilePanel").Initialize();
     SceneItems.GetItem <BoardSettingsWindow>("BoardSettings").Initialize();
     SceneItems.GetItem <CardSelectionWindow>("CardSelection").Initialize();
     SceneItems.GetItem <EditModeWindow>("EditModePanel").Initialize();
 }
Ejemplo n.º 6
0
    public override void Initialize()
    {
        mapEditor = SceneItems.GetItem <MapEditor>("Map");

        enableKey = KeyCode.Alpha2;
        EventManager.StartListening("TileButtonPressed", TileButtonPressed);

        Engine.StartUpdating(this);
    }
Ejemplo n.º 7
0
    public TriggerTile(ushort ID)
    {
        processor = SceneItems.GetItem <CommandProcessor>("CommandProcessor");

        name     = "Trigger";
        tileID   = ID;
        pathCost = 5;

        material  = Resources.Load <Material>("TileMaterials/Trigger");
        meshIndex = material.GetInt("_ID");
    }
Ejemplo n.º 8
0
    private void Start()
    {
        Serializer.ListenForSave(SaveCommands);
        Serializer.ListenForLoad(LoadCommands);

        EventManager.StartListening("CodeFinished", SaveCode);
        EventManager.StartListening("MapCleared", ClearCommands);
        EventManager.StartListening("GetCommandCoords", GetCommandCoords);

        codeEditor  = SceneItems.GetItem("CodeEditor");
        editorField = codeEditor.GetComponent <CodeEditor>();
    }
Ejemplo n.º 9
0
    private void Start()
    {
        mainButtons = SceneItems.GetItem("MainButtons");
        ShowMainButtons();

        EventManager.StartListening("StateChanged", StateChangedHandler);

        selectedText      = SceneItems.GetItem <Text>("SelectedTileText");
        selectedText.text = Map.GetTileType(activeTile).Name;

        dragRect = SceneItems.GetItem <RectTransform>("DragRect");
    }
Ejemplo n.º 10
0
 internal void RemoveItems()
 {
     for (int i = 0; i < SceneItems.Count; i++)
     {
         if (SceneItems[i].MarkForDelete)
         {
             SceneItems[i].OnUnRegister();
             SceneItems[i].SceneParent = null;
             SceneItems.RemoveAt(i);
             i--;
         }
     }
 }
Ejemplo n.º 11
0
    public static Dictionary <string, ConditionCollection> nodeB()
    {
        GameObject  nodeBgo = nodes.GetNode("B");
        SceneSounds ss      = FindObjectOfType <SceneSounds> ();

        AudioReaction whoosh_sound = new AudioReaction();

        whoosh_sound.audioSource = nodeBgo.GetComponent <AudioSource>() as AudioSource;
        whoosh_sound.audioClip   = ss.getSceneSoundByName("movewhoosh").clip;
        whoosh_sound.delay       = 0.0f;

        //float left
        ConditionCollection ccfloatleft = new ConditionCollection();
        ReactionCollection  floatleft_react_collection = new ReactionCollection();
        MoveReaction        floatleft_react            = new MoveReaction();

        floatleft_react.destination          = "A";
        floatleft_react_collection.reactions = new Reaction[] {
            floatleft_react,
            whoosh_sound
        };
        ccfloatleft.reactionCollection = floatleft_react_collection;
        Condition always_true_cond = new Condition();

        always_true_cond.toEval = () => {
            return(true);
        };
        ccfloatleft.requiredConditions = new Condition[] {
            always_true_cond
        };
        //float right
        ConditionCollection ccfloatright = new ConditionCollection();
        ReactionCollection  floatright_react_collection = new ReactionCollection();

        MoveReaction floatright_react = new MoveReaction();

        floatright_react.destination          = "C";
        floatright_react_collection.reactions = new Reaction[] {
            floatright_react,
            whoosh_sound
        };

        ccfloatright.reactionCollection = floatright_react_collection;
        ccfloatright.requiredConditions = new Condition[] {
            always_true_cond
        };

        //kombucha conditions
        Condition kombucha_not_appeared = new Condition();

        kombucha_not_appeared.toEval = () => {
            return(!((bool)GameData.GlobalBools["kombucha_appeared"]));
        };

        Condition kombucha_appeared = new Condition();

        kombucha_appeared.toEval = () => {
            return((bool)GameData.GlobalBools["kombucha_appeared"]);
        };

        //grab
        ConditionCollection ccgrab = new ConditionCollection();
        ReactionCollection  grab_react_collection = new ReactionCollection();

        InstantiateReaction grab_react = new InstantiateReaction();

        grab_react.prefab = Resources.Load <GameObject> ("Prefabs/Kombucha");
        grab_react.pos    = new Vector3(5200, 350, 0);

        GlobalBoolReaction kombucha_appeared_reaction = new GlobalBoolReaction();

        kombucha_appeared_reaction.toSet = "kombucha_appeared";
        kombucha_appeared_reaction.setTo = true;


        AudioReaction kombucha_appeared_react_sound = new AudioReaction();

        kombucha_appeared_react_sound.audioSource = nodeBgo.GetComponent <AudioSource>() as AudioSource;
        kombucha_appeared_react_sound.audioClip   = ss.getSceneSoundByName("oww").clip;
        kombucha_appeared_react_sound.delay       = 0.0f;

        grab_react_collection.reactions = new Reaction[] {
            grab_react,
            kombucha_appeared_reaction,
            kombucha_appeared_react_sound
        };

        ccgrab.reactionCollection = grab_react_collection;
        ccgrab.requiredConditions = new Condition[] {
            kombucha_not_appeared
        };

        ccgrab.reactionCollection.DoInit();

        //look kombucha
        ConditionCollection cclookk = new ConditionCollection();
        ReactionCollection  lookk_react_collection = new ReactionCollection();
        PlayerTextReaction  lookk_react            = new PlayerTextReaction();

        lookk_react.message = "My human drinks a lot of kombucha.";
        lookk_react.delay   = 0f;

        lookk_react_collection.reactions = new Reaction[] {
            lookk_react
        };

        cclookk.reactionCollection = lookk_react_collection;
        cclookk.requiredConditions = new Condition[] {
            kombucha_appeared
        };
        cclookk.reactionCollection.DoInit();

        //look
        ConditionCollection cclook = new ConditionCollection();
        ReactionCollection  look_react_collection     = new ReactionCollection();
        ReactionCollection  look_neg_react_collection = new ReactionCollection();

        PlayerTextReaction look_react = new PlayerTextReaction();

        look_react.message = "kombucha, gross.";
        look_react.delay   = 0f;

        PlayerTextReaction look_neg_react = new PlayerTextReaction();

        look_neg_react.message = "meeeow...if only there was a way to distract her!";
        look_neg_react.delay   = 0f;

        look_react_collection.reactions = new Reaction[] {
            look_react
        };
        look_neg_react_collection.reactions = new Reaction[] {
            look_neg_react
        };

        cclook.reactionCollection    = look_react_collection;
        cclook.negReactionCollection = look_neg_react_collection;
        cclook.requiredConditions    = new Condition[] {
            kombucha_appeared             //TODO: bey is gone?
        };
        cclook.reactionCollection.DoInit();
        cclook.negReactionCollection.DoInit();

        //interact kombucha
        ConditionCollection ccinteractk = new ConditionCollection();
        ReactionCollection  interactk_react_collection = new ReactionCollection();
        GameObjectReaction  interactk_go_reaction      = new GameObjectReaction();

        GameObject[] gos = FindObjectsOfType <GameObject> ();
        foreach (var g in gos)
        {
            if (g.name == "Bey")
            {
                interactk_go_reaction.gameObject = g;
                break;
            }
        }
        interactk_go_reaction.activeState = false;

        GlobalBoolReaction can_exit_tent_reaction = new GlobalBoolReaction();

        can_exit_tent_reaction.toSet = "can_exit_tent";
        can_exit_tent_reaction.setTo = true;

        UninstantiateReaction uninstantiate_kombucha_reaction = new UninstantiateReaction();

        uninstantiate_kombucha_reaction.objectName = "kombucha";

        AudioReaction kombucha_drugged_react_sound = new AudioReaction();

        kombucha_drugged_react_sound.audioSource = nodeBgo.GetComponent <AudioSource>() as AudioSource;
        kombucha_drugged_react_sound.audioClip   = ss.getSceneSoundByName("drugged_the_human").clip;
        kombucha_drugged_react_sound.delay       = 0.0f;

        Condition pills_acquired = new Condition();

        pills_acquired.toEval = () => {
            return(inv.Contains("pills"));
        };

        LostItemReaction pill_loss_react = new LostItemReaction();
        SceneItems       si = FindObjectOfType <SceneItems> ();

        pill_loss_react.item = si.getSceneItemByName("pills");

        interactk_react_collection.reactions = new Reaction[] {
            interactk_go_reaction,
            pill_loss_react,
            can_exit_tent_reaction,
            uninstantiate_kombucha_reaction,
            kombucha_drugged_react_sound
        };

        ccinteractk.reactionCollection = interactk_react_collection;
        ccinteractk.requiredConditions = new Condition[] {
            pills_acquired,
            kombucha_appeared
        };

        ccinteractk.reactionCollection.DoInit();


        Dictionary <string, ConditionCollection> htm = new Dictionary <string, ConditionCollection>();

        htm.Add("float left", ccfloatleft);
        htm.Add("float right", ccfloatright);
        htm.Add("grab", ccgrab);
        htm.Add("look kombucha", cclookk);
        htm.Add("look", cclook);
        htm.Add("interact kombucha", ccinteractk);
        return(htm);
    }
Ejemplo n.º 12
0
 private void EditModeChanged(Data data)
 {
     SceneItems.GetItem <MapEditor>("Map").SetEditMode(data.num);
     gameObject.SetActive(false);
 }
Ejemplo n.º 13
0
 private void Start()
 {
     posLabel = SceneItems.GetItem <Text>("DebugPosition");
     EventManager.StartListening("StateChanged", StateChangedHandler);
 }
Ejemplo n.º 14
0
 internal void AddToSceneItems(SceneItem item)
 {
     item.id = GetNewID();
     SceneItems.Add(item);
 }
Ejemplo n.º 15
0
 private void Start()
 {
     myLabel = SceneItems.GetItem <Text>("DebugFPS");
 }
Ejemplo n.º 16
0
 private void SelectingCards(Data data)
 {
     gameObject.SetActive(false);
     SceneItems.GetItem("CardSelection").SetActive(true);
 }
Ejemplo n.º 17
0
 private void Start()
 {
     currentCardImage = SceneItems.GetItem <Image>("DisplayedCard");
     EventManager.StartListening("DrawCard", DrawCard);
     EventManager.StartListening("CardToggled", ToggleCard);
 }
Ejemplo n.º 18
0
 public string GetSceneItemCount(SceneItems sceneitem)
 {
     var sceneItem = new Link(By.XPath(string.Format(SceneItem, itemnames[sceneitem])), itemnames[sceneitem]).GetElement().Text;
     return sceneItem;
 }
Ejemplo n.º 19
0
 private void Start()
 {
     cam = SceneItems.GetItem <GameCamera>("GameCamera");
     turnDisplayPanel = SceneItems.GetItem("TurnDisplayPanel");
     turnText         = SceneItems.GetItem <Text>("TurnText");
 }
Ejemplo n.º 20
0
    public static Dictionary <string, ConditionCollection> nodeC()
    {
        GameObject  nodeCgo = nodes.GetNode("C");
        SceneSounds ss      = FindObjectOfType <SceneSounds> ();

        AudioReaction whoosh_sound = new AudioReaction();

        whoosh_sound.audioSource = nodeCgo.GetComponent <AudioSource>() as AudioSource;
        whoosh_sound.audioClip   = ss.getSceneSoundByName("movewhoosh").clip;
        whoosh_sound.delay       = 0.0f;

        //float left
        ConditionCollection ccfloatleft = new ConditionCollection();
        ReactionCollection  floatleft_react_collection = new ReactionCollection();
        MoveReaction        floatleft_react            = new MoveReaction();

        floatleft_react.destination          = "B";
        floatleft_react_collection.reactions = new Reaction[] {
            floatleft_react,
            whoosh_sound
        };
        ccfloatleft.reactionCollection = floatleft_react_collection;
        Condition always_true_cond = new Condition();

        always_true_cond.toEval = () => {
            return(true);
        };
        ccfloatleft.requiredConditions = new Condition[] {
            always_true_cond
        };

        //float right
        ConditionCollection ccfloatright = new ConditionCollection();
        ReactionCollection  floatright_react_collection = new ReactionCollection();
        PlayerTextReaction  floatright_react            = new PlayerTextReaction();

        floatright_react.message = "There is nothing to the right.";
        //		floatright_react.textColor = Color.white;
        floatright_react.delay = 0.01f;
        AudioReaction floatright_react_sound = new AudioReaction();

        floatright_react_sound.audioSource    = nodeCgo.GetComponent <AudioSource>() as AudioSource;
        floatright_react_sound.audioClip      = ss.getSceneSoundByName("meow1").clip;
        floatright_react_sound.delay          = 0.0f;
        floatright_react_collection.reactions = new Reaction[] {
            floatright_react,
            floatright_react_sound
        };
        Condition always_true_init_cond = new Condition();

        always_true_init_cond.toEval = () => {
            ccfloatright.reactionCollection.DoInit();
            return(true);
        };
        ccfloatright.reactionCollection = floatright_react_collection;
        ccfloatright.requiredConditions = new Condition[] {
            always_true_init_cond
        };

        //grab
        ConditionCollection  ccgrab = new ConditionCollection();
        ReactionCollection   grab_react_collection = new ReactionCollection();
        PickedUpItemReaction grab_react            = new PickedUpItemReaction();
        SceneItems           si = FindObjectOfType <SceneItems> ();

        grab_react.item = si.getSceneItemByName("pills");

        GameObjectReaction grab_pills_react = new GameObjectReaction();

        GameObject[] gos = FindObjectsOfType <GameObject> ();
        foreach (var g in gos)
        {
            if (g.name == "pills")
            {
                grab_pills_react.gameObject = g;
                break;
            }
        }
        grab_pills_react.activeState = false;

        AudioReaction grab_pills_react_sound = new AudioReaction();

        grab_pills_react_sound.audioSource = nodeCgo.GetComponent <AudioSource>() as AudioSource;
        grab_pills_react_sound.audioClip   = ss.getSceneSoundByName("pills").clip;
        grab_pills_react_sound.delay       = 0.0f;

        grab_react_collection.reactions = new Reaction[] {
            grab_react,
            grab_pills_react,
            grab_pills_react_sound
        };

        Condition pills_not_yet_acquired = new Condition();

        pills_not_yet_acquired.toEval = () => {
            return(!inv.Contains("pills"));
        };

        ccgrab.reactionCollection = grab_react_collection;
        ccgrab.requiredConditions = new Condition[] {
            pills_not_yet_acquired
        };
        ccgrab.reactionCollection.DoInit();

        //look
        ConditionCollection cclook = new ConditionCollection();
        ReactionCollection  look_react_collection = new ReactionCollection();
        PlayerTextReaction  look_react            = new PlayerTextReaction();

        look_react.message = "My human’s happy pills, fun to bat under the couch.";
        //		floatright_react.textColor = Color.white;
        look_react.delay = 0.01f;

        look_react_collection.reactions = new Reaction[] {
            look_react
        };

        cclook.reactionCollection = look_react_collection;
        cclook.requiredConditions = new Condition[] {
            pills_not_yet_acquired
        };
        cclook.reactionCollection.DoInit();

        //interact
        ConditionCollection ccinteract = new ConditionCollection();
        ReactionCollection  interact_react_collection = new ReactionCollection();

        PlayerTextReaction interact_ptext_react = new PlayerTextReaction();

        interact_ptext_react.message = "meow...pills are for humans, not magic cats!";
        interact_ptext_react.delay   = 0f;

        interact_react_collection.reactions = new Reaction[] {
            interact_ptext_react
        };
        Condition cannot_exit_cond = new Condition();

        cannot_exit_cond.toEval = () => {
            return(!(bool)GameData.GlobalBools["can_exit_tent"]);
        };
        ccinteract.reactionCollection = interact_react_collection;
        cclook.requiredConditions     = new Condition[] {
            pills_not_yet_acquired,
            cannot_exit_cond
        };
        ccinteract.reactionCollection.DoInit();

        Dictionary <string, ConditionCollection> htm = new Dictionary <string, ConditionCollection>();

        htm.Add("float left", ccfloatleft);
        htm.Add("float right", ccfloatright);
        htm.Add("grab", ccgrab);
        htm.Add("look", cclook);
        htm.Add("interact", ccinteract);

        return(htm);
    }