Example #1
0
        public Part getCopy()
        {
            Part newPart = new Part ();
            newPart.tag = new PartTag ();
            newPart.tag.set (tag.index, tag.level, tag.parent, tag.node);
            //newPart.nodes = new Node[nodes.Length];
            newPart.nodes = nodes.Clone() as Node[];
            newPart.type = type;

            newPart.baseStats = baseStats.getCopy();

            newPart.currentPower = currentPower;
            newPart.active = active;
            newPart.powerIn = powerIn;
            newPart.powerOut = powerOut;

            newPart.item = invItem();

            newPart.localx = localx;
            newPart.localy = localy;
            newPart.localz = localz;

            newPart.rotatex = rotatex;
            newPart.rotatey = rotatey;
            newPart.rotatez = rotatez;

            newPart.thisRotation = thisRotation;
            newPart.thisPos = thisPos;

            return newPart;
        }
Example #2
0
 public Node getCompatableNode(Part newPart)
 {
     for (int i=0; i < nodes.Length; i+=1) {
         if(nodes[i].validate(newPart)) {
             return nodes[i];
         }
     }
     //if we are here, then nothing validated
     return null;
 }
Example #3
0
        public bool validate(Part newPart)
        {
            if (equipped) {
                Debug.Log("already connected!");
                return false;
            }
            if (!(newPart.type == typeRestriction)) {//likely will need to be a more complex check
                Debug.Log ("not compatable");
                return false;
            }

            return true; //this node is empty and accepts this part type
        }