public IKMember(ParasiteBodyPart skin, float distance) { this.distance = distance; this.defaultdistance = distance; // default distance this.skin = skin; // init nnb nnb = new List <IKMember>(); }
public void CreateParasite(int numParts) { // Create the Tail tail = new ParasiteTail(theSprite, 1.0f); tail.position = new Vector2(150 + (50 * numParts), 100); // Create Body Parts for (int i = 0; i < numParts; i++) { ParasiteBodyPart bodyPart = new ParasiteBodyPart(theSprite, 1f); bodyPart.position = new Vector2(150 + (50 * i), 100); bodyparts.Add(bodyPart); } // Create the Head head = new ParasiteHead(theSprite, 1); head.position = new Vector2(100, 100); // IKPoints theParasite.Add(head); IKMember headIK = new IKMember(head, 10); IKMember lastIK = headIK; head.AddIKPoint(headIK); for (int i = 0; i < bodyparts.Count; i++) { ParasiteBodyPart bodyPart = bodyparts[i]; theParasite.Add(bodyPart); IKMember ik = new IKMember(bodyPart, 10); if (i != 0) { ik.addNeighbour(lastIK); } lastIK.addNeighbour(ik); bodyPart.AddIKPoint(ik); lastIK = ik; } // Uncomment for Rad Wiggle Motion! // currentIK = new IKMember(tail, 1); //currentIK = new IKMember(tail, 10); theParasite.Add(tail); IKMember tailIK = new IKMember(tail, 10); tailIK.addNeighbour(lastIK); lastIK.addNeighbour(tailIK); tail.AddIKPoint(tailIK); tail.initTail(); }