コード例 #1
0
 //verifica lo que esta chocando
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Wall")
     {
         float Side_Position = Mathf.Sign(Enemy.GetComponent <Rigidbody2D>().transform.position.x - collision.transform.position.x);
         Enemy.Addforce       = true;
         Enemy.Ball_Direction = Side_Position * Snow_Speed;
         if (Enemy.Enemy_Speed > -0.01f)
         {
             Enemy.Ball_Direction *= -1;
         }
     }
     if (collision.gameObject.tag == "Wall_End" && Carry == true)
     {
         Player.GetComponent <Rigidbody2D>().simulated = true;
         Player.SendMessage("Surf_Snowball", false);
         Player.Player_State = Player_Script.PlayerState.Jump;
         Instantiate(Sw_Particle, transform.position, Quaternion.identity);
     }
     else if (collision.gameObject.tag == "Wall_End" && Carry == false)
     {
         Instantiate(Sw_Particle, transform.position, Quaternion.identity);
     }
 }