// Use this for initialization void Start() { RB = GetComponent <Rigidbody>(); if (HorseRigidBody) { DHorses = HorseRigidBody.GetComponent <PullingHorses>(); //Get the Reference for the PullingHorses Script } if (Body && BodyCollider) { Body.parent = BodyCollider; //Parent Body to the Collider } if (StearMesh && StearCollider) { StearMesh.parent = StearCollider; //Parent Body to the Collider } if (HorseRigidBody && HorseJoint) { HorseJoint.connectedBody = HorseRigidBody; } if (CenterOfMass) { RB.centerOfMass = CenterOfMass.localPosition; } }
public override void EnableControls(bool value) { WagonController WG = GetComponent <WagonController>(); if (WG.HorseRigidBody == null) { return; } PullingHorses PH = WG.HorseRigidBody.GetComponent <PullingHorses>(); if (PH) { if (PH.RightHorse) { PH.RightHorse.MovementAxis = Vector3.zero; PH.RightHorse.GetComponent <MalbersInput>().enabled = value; } if (PH.LeftHorse) { PH.RightHorse.MovementAxis = Vector3.zero; PH.LeftHorse.GetComponent <MalbersInput>().enabled = value; } } else { WG.HorseRigidBody.GetComponent <Animal>().GetComponent <MalbersInput>().enabled = value; } }
// Use this for initialization void Start() { _rigidbody = GetComponent <Rigidbody>(); if (HorseRigidBody) { DHorses = HorseRigidBody.transform.GetComponent <PullingHorses>(); //Get the Reference for the PullingHorses Script } if (Body && BodyCollider) { Body.parent = BodyCollider; //Parent Body to the Collider } if (StearMesh && StearCollider) { StearMesh.parent = StearCollider; //Parent Body to the Collider } if (HorseRigidBody && HorseJoint) { HorseJoint.connectedBody = HorseRigidBody; } }