void OnTriggerEnter(Collider pCollision) { //cars and pedestrians have reversed behaviours. If StopStation is on WALK, //pedestrians can walk and cars have to stop. If it's on STOP, //pedestrians have to stop and cars can keep going through their trajectory if (pCollision.transform.CompareTag("NPC")) { mColliders.Add(pCollision); switch (mCurrentState) { case States.WALK: pCollision.transform.GetComponent <PopulationEngine.NPCMotor> ().Walking(); break; case States.STOP: default: pCollision.transform.GetComponent <PopulationEngine.NPCMotor> ().Waiting(); break; } // Physics.IgnoreCollision (mCollider, pCollision, true); } else { if (pCollision.transform.CompareTag("Vehicle")) { PopulationEngine.NPCMotor motor = pCollision.transform.GetComponent <PopulationEngine.NPCMotor> (); RunOver runOver = pCollision.transform.GetComponent <RunOver> (); mColliders.Add(pCollision); switch (mCurrentState) { case States.WALK: if (motor) { motor.Waiting(); } else { runOver.Resume(); } break; case States.STOP: default: if (motor) { pCollision.transform.GetComponent <PopulationEngine.NPCMotor> ().Walking(); } else { runOver.Stop(); } break; } } } }
void OnCollisionEnter(Collision pCollision) { // if (transform.CompareTag ("Vehicle")) // { if (pCollision.transform.CompareTag("internal_collider") || pCollision.transform.CompareTag("NPC")) { PopulationEngine.NPCMotor motor = transform.parent.parent.GetComponent <PopulationEngine.NPCMotor>(); RunOver runOver = transform.parent.parent.GetComponent <RunOver>(); if (motor) { Debug.Log("collision from " + transform.parent.name + " with " + pCollision.transform.name + ", stopping"); motor.Waiting(); } else { if (runOver) { runOver.Stop(); } } } // } }
public void TurnOnRagdoll(bool pRagdollMode, Vector3 pCollisionOrigin) { fallDown = pRagdollMode; if (pRagdollMode) { // if (!mFlyAway) // { mCollisionOrigin = pCollisionOrigin; mMotor.Waiting(); mFlyAwayTimer = 0; mFlyAway = true; mRDHelper.ragdolled = true; // } } else { mRDHelper.ragdolled = pRagdollMode; mMotor.Walking(); } }