Exemplo n.º 1
0
    void Start()
    {
        //Get all the rigid bodies that belong to the ragdoll
        Rigidbody[] rigidBodies = GetComponentsInChildren <Rigidbody>();

        //Add the RagdollPartScript to all the gameobjects that also have the a rigid body
        foreach (Rigidbody body in rigidBodies)
        {
            RagdollPartScript rps = body.gameObject.AddComponent <RagdollPartScript>();
            rps.mainScript = this;
        }
    }
Exemplo n.º 2
0
    public void OnRagdollChange(RagdollPartScript RagdollPart)
    {
        bool AnyRagdolls    = HasAnyRagdollParts();
        var  animator       = this.GetComponent <Animator> ();
        bool EnableAnimator = !AnyRagdolls;

        if (EnableAnimator != animator.enabled)
        {
            Debug.Log("Animator enabled now: " + EnableAnimator);
            animator.enabled = EnableAnimator;
        }
    }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        //Get all the rigid bodies that belong to the ragdoll
        Rigidbody[] rigidBodies = GetComponentsInChildren <Rigidbody>();

        //Add the RagdollPartScript to all the gameobjects that also have the a rigid body
        foreach (Rigidbody body in rigidBodies)
        {
            RagdollPartScript rps = body.gameObject.AddComponent <RagdollPartScript>();

            //Set the scripts mainScript reference so that it can access
            //the score and scoreTextTemplate member variables above
            rps.mainScript = this;
        }
    }
Exemplo n.º 4
0
 public void DoHit(RagdollPartScript Part, Vector3 Direction)
 {
     /*
      * //Debug.Log ("DoHit()");
      * //find the RagdollHelper component and activate ragdolling
      * RagdollHelper helper=GetComponent<RagdollHelper>();
      * helper.ragdolled=true;
      *
      * //set the impact target to whatever the ray hit
      * impactTarget = Body;
      *
      * //impact direction also according to the ray
      * impact = Direction * 2.0f;
      *
      * //the impact will be reapplied for the next 250ms
      * //to make the connected objects follow even though the simulated body joints
      * //might stretch
      * impactEndTime=Time.time+0.25f;
      */
 }