Exemplo n.º 1
0
        /// <summary>
        /// Makes a basic plane part graph with all the basic parts
        /// </summary>
        /// <returns>Root PartNode of the plane part graph</returns>
        private PartNode MakeDebugPlane()
        {
            PartNode cockpit = new PartNode(new Cockpit_MK1());

            PartNode leftWing = new PartNode(new Wing_MK1());
            cockpit.AttachNode(leftWing);
            PartNode leftAileron = new PartNode(new Aileron_MK1());
            leftWing.AttachNode(leftAileron);

            PartNode rightWing = new PartNode(new Wing_MK1());
            cockpit.AttachNode(rightWing);
            PartNode rightAileron = new PartNode(new Aileron_MK1());
            rightWing.AttachNode(rightAileron);

            PartNode fuselage = new PartNode(new Fuselage_MK1());
            cockpit.AttachNode(fuselage);
            PartNode leftElevator = new PartNode(new Elevator_MK1());
            fuselage.AttachNode(leftElevator);
            PartNode rightElevator = new PartNode(new Elevator_MK1());
            fuselage.AttachNode(rightElevator);
            PartNode rudder = new PartNode(new Rudder_MK1());
            fuselage.AttachNode(rudder);

            PartNode engine = new PartNode(new Engine_MK1());
            cockpit.AttachNode(engine);

            PartNode mg1 = new PartNode(new Gun_MK1());
            engine.AttachNode(mg1);
            PartNode mg2 = new PartNode(new Gun_MK1());
            engine.AttachNode(mg2);

            return cockpit;
        }
Exemplo n.º 2
0
 // ---- Methods ----
 public bool SeverNode(PartNode node)
 {
     if (connectedNodes.Contains(node)) {
         // This node is attached to the other node.  Sever the connection.
         connectedNodes.Remove(node);
         node.SeverNode(this);
         return true;
     } else {
         // This node is not attached to the other node.  Do nothing.
         return false;
     }
 }
Exemplo n.º 3
0
 // ---- Constructors ----
 public Aircraft(string name, PartNode basePart)
 {
     this.Name = name;
     this.BasePart = basePart;
     partListNeedsUpdate = true;
 }
Exemplo n.º 4
0
 public bool AttachNode(PartNode node)
 {
     if (!connectedNodes.Contains(node)) {
         // This node is not attached to the other node.  Attach it.
         connectedNodes.Add(node);
         node.AttachNode(this);
         return true;
     } else {
         // This node is already attached to the other node.  Do nothing.
         return false;
     }
 }