Exemple #1
0
 /*void drawLives()
  * {
  *  for (int i = 0; i < lives; i++)
  *  {
  *      Instantiate(life, new Vector3(life.transform.position.x + lifeOffset*i, 14, 0), Quaternion.identity, transform);
  *
  *  }
  * }*/
 void Pushback()
 {
     if (Vector3.Distance(transform.position, otherPlayer.transform.position) < pushbackDistance && Time.time > timeSincePushed + pushTime)
     {
         timeSincePushed = Time.time;
         print("Push ");
         otherPlayer.GetComponent <PlayerScripts>().BeingPushed();
         otherPlayer.GetComponent <Rigidbody>().AddForce(Vector3.Normalize(otherPlayer.transform.position - gameObject.transform.position) * pushForce, ForceMode.Impulse);
         audioScript.HitSound();
     }
 }