public bool IsBodyPartCollected(BodyPartTypes bodyPartType) { UIBodyPart part = this.GetBodyPart(bodyPartType); if (part != null) { return(part.IsCollected()); } return(false); }
/*public void CollectBodyPart(BodyPartTypes bodyPartType, bool isCorrectPart) * { * UIBodyPart part = this.GetBodyPart(bodyPartType); * * if (part != null && !part.IsCollected()) * { * part.Collect(isCorrectPart); * this.collectedParts.Add(part); * * if (isCorrectPart) * { * this.correctPartCount++; * } * } * }*/ public void CollectBodyPart(GameObject bodyPart) { BodyPartObject bodyPartObj = bodyPart.GetComponent <BodyPartObject>(); UIBodyPart part = this.GetBodyPart(bodyPartObj.part); if (part != null && !part.IsCollected()) { part.Collect(bodyPart); this.collectedParts.Add(part); if (bodyPartObj.isCorrect) { this.correctPartCount++; } } }
private UIBodyPart GetBodyPart(BodyPartTypes partType) { UIBodyPart part = null; UIBodyPart[] partList = GameObject.FindObjectsOfType <UIBodyPart>(); foreach (UIBodyPart bodyPart in partList) { if (bodyPart.partType == partType) { part = bodyPart; } } return(part); }
public GameObject RemoveLastBodyPart() { if (this.collectedParts.Count > 0) { UIBodyPart lastBodyPart = (UIBodyPart)this.collectedParts[this.collectedParts.Count - 1]; //this.collectedParts[this.collectedPartCount - 1]; if (lastBodyPart != null) { if (lastBodyPart.IsCorrect()) { this.correctPartCount--; } GameObject uncollectedPart = lastBodyPart.Uncollect(); this.collectedParts.RemoveAt(this.collectedParts.Count - 1); return(uncollectedPart); } return(null); } return(null); }