Esempio n. 1
0
    public void populateBody()                                  //currently invoked by game controller script on button press
    {
        healthMax = 0;
        //StartCoroutine (waitForBpartMakerScript ());
        wholeBodyOfParts.resetBodyToZero();

        wholeBodyOfParts.setBodyPart(BpartMaker.makeBodyPart("large biped arm", "left"));
        //Debug.Log ("large biped arm, left");
        wholeBodyOfParts.setBodyPart(BpartMaker.makeBodyPart("large biped arm", "right"));
        //Debug.Log ("large biped arm, "+ "right");
        wholeBodyOfParts.setBodyPart(BpartMaker.makeBodyPart("large biped head", "left"));
        //Debug.Log ("soforth");
        wholeBodyOfParts.setBodyPart(BpartMaker.makeBodyPart("large biped leg", "left"));
        //Debug.Log ("soforth");
        wholeBodyOfParts.setBodyPart(BpartMaker.makeBodyPart("large biped leg", "right"));
        //Debug.Log ("soforth");
        wholeBodyOfParts.setBodyPart(BpartMaker.makeBodyPart("large biped shoulder", "left"));
        //Debug.Log ("soforth");
        wholeBodyOfParts.setBodyPart(BpartMaker.makeBodyPart("large biped shoulder", "right"));
        //Debug.Log ("soforth");
        wholeBodyOfParts.setBodyPart(BpartMaker.makeBodyPart("large biped torso", "none"));
//		print ("play area dim " + playAreaDimensions);
        wholeBodyOfParts = BpartMaker.createWholeBody(wholeBodyOfParts, playAreaDimensions);                    //setting internal location positions of each of the body parts in relation to eachother
        for (int i = 0; i < wholeBodyOfParts.listOfAllParts.Count; i++)
        {
            healthMax += wholeBodyOfParts.listOfAllParts [i].getCurrentHealth();                        //makes health pool
        }
        foreach (BPartGenericScript bPart in wholeBodyOfParts.listOfAllParts)
        {
            bPart.GetComponent <Transform>().SetParent(gameObject.GetComponent <Transform>());
        }
        remainingHealth = healthMax;
        updateHealthDisplay();
    }
Esempio n. 2
0
    public WholeBodyOfParts createWholeBody(WholeBodyOfParts incomingWholeBodyOfParts, Vector2 incomingDimensionsOfPlayArea)
    {
        for (int i = 0; i < 5; i++)
        {
//			Debug.Log (incomingWholeBodyOfParts.leftArm.getName());
//			Debug.Log (incomingWholeBodyOfParts.rightArm.getName());
//			Debug.Log (incomingWholeBodyOfParts.torso.getName());
        }
        if (incomingWholeBodyOfParts.bodyPartCheck())
        {
            Vector2 offSetToCenter = new Vector2
                                         (Mathf.Round(incomingDimensionsOfPlayArea.x / 2) - Mathf.Round(incomingWholeBodyOfParts.torso.getDimensionsOfPart().x / 2) + 1, //the far left point that the torso needs to be center, it's origin x point
                                         incomingWholeBodyOfParts.leftLeg.getAnchorPoint().y - 1);

            incomingWholeBodyOfParts.torso.setTorsoOriginPosition(offSetToCenter);
//			incomingWholeBodyOfParts.torso.setInternalGlobalCords ();
//			print (incomingWholeBodyOfParts.torso.getInternalGlobalCord(new Vector2(0.0f, 0.0f)));

            incomingWholeBodyOfParts.leftLeg.setGlobalPosition(incomingWholeBodyOfParts.torso.getGlobalAnchorPoint("LeftLegPoint"));
//			incomingWholeBodyOfParts.leftLeg.setInternalGlobalCords ();
//			print (incomingWholeBodyOfParts.leftLeg.getInternalGlobalCord(new Vector2(0.0f, 0.0f)));

            incomingWholeBodyOfParts.rightLeg.setGlobalPosition(incomingWholeBodyOfParts.torso.getGlobalAnchorPoint("RightLegPoint"));
//			incomingWholeBodyOfParts.rightLeg.setInternalGlobalCords ();
//			print (incomingWholeBodyOfParts.rightLeg.getInternalGlobalCord(new Vector2(0.0f, 0.0f)));

            incomingWholeBodyOfParts.head.setGlobalPosition(incomingWholeBodyOfParts.torso.getGlobalAnchorPoint("HeadPoint"));
//			incomingWholeBodyOfParts.head.setInternalGlobalCords ();
//			print (incomingWholeBodyOfParts.head.getInternalGlobalCord(new Vector2(0.0f, 0.0f)));

            incomingWholeBodyOfParts.leftShoulder.setGlobalPositionOffComplexAnchor(incomingWholeBodyOfParts.torso.getGlobalAnchorPoint("LeftShoulderPoint"), "TorsoPoint");
//			incomingWholeBodyOfParts.leftShoulder.setInternalGlobalCords ();
//			print (incomingWholeBodyOfParts.leftShoulder.getInternalGlobalCord(new Vector2(0.0f, 0.0f)));

            incomingWholeBodyOfParts.rightShoulder.setGlobalPositionOffComplexAnchor(incomingWholeBodyOfParts.torso.getGlobalAnchorPoint("RightShoulderPoint"), "TorsoPoint");
//			incomingWholeBodyOfParts.rightShoulder.setInternalGlobalCords ();
//			print (incomingWholeBodyOfParts.rightShoulder.getInternalGlobalCord(new Vector2(0.0f, 0.0f)));

            incomingWholeBodyOfParts.leftArm.setGlobalPosition(incomingWholeBodyOfParts.leftShoulder.getGlobalAnchorPoint("ArmPoint"));
//			incomingWholeBodyOfParts.leftArm.setInternalGlobalCords ();
//			print (incomingWholeBodyOfParts.leftArm.getInternalGlobalCord(new Vector2(0.0f, 0.0f)));

            incomingWholeBodyOfParts.rightArm.setGlobalPosition(incomingWholeBodyOfParts.rightShoulder.getGlobalAnchorPoint("ArmPoint"));
//			incomingWholeBodyOfParts.rightArm.setInternalGlobalCords ();
//			print (incomingWholeBodyOfParts.rightArm.getInternalGlobalCord(new Vector2(0.0f, 0.0f)));
        }
        else
        {
            Debug.Log("There are body parts missing");
        }
        return(incomingWholeBodyOfParts);
    }