Exemplo n.º 1
0
        public List <Node> GetNodes(Node.NODE_TYPE a_Type)
        {
            List <Node> nodeOfType = new List <Node>();

            foreach (Node n in nodes)
            {
                if (n.GetNodeType == a_Type)
                {
                    nodeOfType.Add(n);
                }
            }

            return(nodeOfType);
        }
Exemplo n.º 2
0
    // Update is called once per frame
    public void updateDisplayWithCurrentNode(Node currentNode)
    {
        Node.NODE_TYPE currentNodeType = currentNode.getNodeType();

        if (currentNodeType == Node.NODE_TYPE.CHOICE)
        {
            Choice newOptions = (Choice)currentNode;
            this.activeChoiceButtonManager.showChoices(newOptions.getChoices());
        }
        else if (currentNodeType == Node.NODE_TYPE.DIALOGUE)
        {
            Dialogue newDialogue = (Dialogue)currentNode;
            this.activeTextDisplayManager.supplyNewDialogue(newDialogue.getListOfDialogues(), newDialogue.getDialogueCharacter().name());
        }
    }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a scene from a stream
        /// </summary>
        /// <param name="_Reader"></param>
        /// <param name="_TextureProvider"></param>
        /// <returns></returns>
        public void             Load(System.IO.BinaryReader _Reader)
        {
            // Read back textures
            ClearTextures();
            int TexturesCount = _Reader.ReadInt32();

            for (int TextureIndex = 0; TextureIndex < TexturesCount; TextureIndex++)
            {
                Texture2D T = new Texture2D(this, _Reader);
                m_Textures.Add(T);
                m_URL2Texture.Add(T.URL, T);
                m_ID2Texture.Add(T.ID, T);
            }
            m_TextureIDCounter = m_Textures.Count;

            // Read back material parameters
            ClearMaterialParameters();
            int MaterialParametersCount = _Reader.ReadInt32();

            for (int MaterialParameterIndex = 0; MaterialParameterIndex < MaterialParametersCount; MaterialParameterIndex++)
            {
                MaterialParameters MP = new MaterialParameters(this, _Reader);
                m_MaterialParameters.Add(MP);
                m_ID2MaterialParameters.Add(MP.ID, MP);
            }
            m_MaterialParametersIDCounter = m_MaterialParameters.Count;

            // Read back the nodes hierarchy
            ClearNodes();
            bool bHasRoot = _Reader.ReadBoolean();

            if (!bHasRoot)
            {
                return;
            }

            // Read back root type
            Node.NODE_TYPE Type = (Node.NODE_TYPE)_Reader.ReadByte();
            switch (Type)
            {
            case Node.NODE_TYPE.NODE:
                m_Root = new Node(this, null, _Reader);
                break;

            case Node.NODE_TYPE.MESH:
                m_Root = new Mesh(this, null, _Reader);
                m_Meshes.Add(m_Root as Mesh);
                break;

            case Node.NODE_TYPE.LIGHT:
                m_Root = new Light(this, null, _Reader);
                m_Lights.Add(m_Root as Light);
                break;

            case Node.NODE_TYPE.CAMERA:
                m_Root = new Camera(this, null, _Reader);
                m_Cameras.Add(m_Root as Camera);
                break;
            }
            m_ID2Node[m_Root.ID] = m_Root;


            // Propagate state once so matrices are up to date
            m_Root.PropagateState();
        }