private void OnCollisionEnter(Collision collision) { Rigidbody otherRB = collision.collider.attachedRigidbody; otherRB.isKinematic = false; CharacterController controller = GetComponentInParent <CharacterController>(); PoolCueBehavior poolCue = GetComponentInParent <PoolCueBehavior>(); RagDollController ragDollController = collision.gameObject.GetComponentInParent <RagDollController>(); if (ragDollController) { ragDollController.isRagdollOn = true; } float movementScale = controller.velocity.magnitude / poolCue.poolCueMovementSpeed; float forceToApply = hitForce * movementScale; otherRB.AddForce(transform.forward * forceToApply, ForceMode.Impulse); }
public virtual void Start() { anim = GetComponentInChildren <Animator>(); ragdoll = GetComponent <RagDollController>(); agent = GetComponent <NavMeshAgent>(); }
private void Awake() { ragDollController = GetComponent <RagDollController>(); }
public void setUp(Transform newHead, RagDollController newRagdoll, Transform[] newAccessories) { head = newHead; ragDoll = newRagdoll; accessories = newAccessories; pathMover = GetComponent<PathMover>(); player = GameObject.FindWithTag ("Player").transform; GameObject guardRoomObj = GameObject.FindWithTag("GuardRoom"); if (guardRoomObj) guardRoom = guardRoomObj.GetComponent<GuardRoom>(); enemyAI = GetComponent<EnemyAI>(); enemyAnimator = GetComponent<EnemyAnimator>(); characterController = GetComponent<CharacterController>(); startWalking(); Events.Listen(gameObject, "SoundEvents"); //color the minimap dot Transform miniMapDot = transform.Find("MiniMapUnit"); if (miniMapDot) { switch (EnemyType) { case EnemyTypes.Guard : miniMapDot.renderer.material.color = Color.red; break; case EnemyTypes.Janitor : miniMapDot.renderer.material.color = Color.cyan; break; default : miniMapDot.renderer.material.color = Color.black; break; } miniMapDot.renderer.material.renderQueue = 3000 + Random.Range(1, 500); } }
public void SetUp(Transform thiefHead, RagDollController thiefRagDoll, BombThrower newBombThrower, WristWeapon newWristWeapon) { ragDoll = thiefRagDoll; playerBombThrower = newBombThrower; wristWeapon = newWristWeapon; characterController = GetComponent<CharacterController>(); playerAnimator = GetComponent<PlayerAnimator>(); Transform miniMapDot = transform.Find("MiniMapUnit"); if (miniMapDot) { miniMapDot.renderer.material.color = Color.yellow; miniMapDot.renderer.material.renderQueue = 3500; } GameObject gameControlObj = GameObject.Find ("GameControl"); gameControl = gameControlObj.GetComponent<GameControl>(); }