Esempio n. 1
0
 public static void Switch(Node lampNode)
 {
     Lamp lamp = (Lamp)lampNode;
     if(lamp.enabled)
     {
         lamp.Disable();
     }
     else
     {
         lamp.Enable();
     }
 }
Esempio n. 2
0
 public LampSwitch(string name, Node connectedLamps)
     : base(name)
 {
     this.connectedLamps = connectedLamps;
     lampHead = new Entity(name + "_head");
     lampPost = new Entity(name + "_post");
     lampHead.mesh = new Mesh();
     lampPost.mesh = new Mesh();
     lampHead.mesh.polygonList = Lamp.lampHeadMesh.polygonList;
     lampPost.mesh.polygonList = Lamp.lampPostMesh.polygonList;
     lampHead.mesh.material.textureName = lampPost.mesh.material.textureName = "white";
     lampHead.position = new Vector3(0f, 60f, 0f);
     lampHead.mesh.material.baseColor = new Color4(0.9f, 0.3f, 0.3f, 1.0f);
     lampPost.mesh.material.baseColor = new Color4(0.6f, 0.3f, 0.3f, 1.0f);
     Add(lampHead);
     Add(lampPost);
 }
Esempio n. 3
0
 /// <summary>
 /// Delete and detach specified child.
 /// </summary>
 /// <param name="node">The child</param>
 public void RemoveChild(Node node)
 {
     if(children.ContainsValue(node))
     {
         node = null;
         children.Remove(node.name); //TODO: performance
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Checks if this node contains the specified node. 
 /// </summary>
 /// <param name="node">The node</param>
 /// <returns>True if this node contains the specified node</returns>
 public bool HasChild(Node node)
 {
     return this == node.parent; // TODO: performance check
     //return children.ContainsValue(node);
 }
Esempio n. 5
0
 public bool Equals(Node obj)
 {
     return name == obj.name;
 }
Esempio n. 6
0
        /// <summary>
        /// Add specified node as child.
        /// </summary>
        /// <param name="node">The node to be added</param>
        public void Add(Node node)
        {
            if(node == this)
            {

            }
            else
            {
                node.parent = this;
                children.Add(node.name, node);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Add specified node as child, and rename it.
        /// </summary>
        /// <param name="node">The node to be added</param>
        /// <param name="newName">The new node name</param>
        public void Add(Node node, string newName)
        {
            node.name = newName;
            if(node == this)
            {

            }
            else
            {
                node.parent = this;
                children.Add(node.name, node);
            }
        }