示例#1
0
文件: Lamp.cs 项目: carlosFPGA/resim
 public static void Switch(Node lampNode)
 {
     Lamp lamp = (Lamp)lampNode;
     if(lamp.enabled)
     {
         lamp.Disable();
     }
     else
     {
         lamp.Enable();
     }
 }
示例#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);
 }
示例#3
0
文件: Node.cs 项目: carlosFPGA/resim
 /// <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
     }
 }
示例#4
0
文件: Node.cs 项目: carlosFPGA/resim
 /// <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);
 }
示例#5
0
文件: Node.cs 项目: carlosFPGA/resim
 public bool Equals(Node obj)
 {
     return name == obj.name;
 }
示例#6
0
文件: Node.cs 项目: carlosFPGA/resim
        /// <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);
            }
        }
示例#7
0
文件: Node.cs 项目: carlosFPGA/resim
        /// <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);
            }
        }