18 lines
507 B
C#
18 lines
507 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class WallBouncer : MonoBehaviour
|
|
{
|
|
void OnTriggerEnter(Collider other)
|
|
{
|
|
var ballMovement = other.GetComponent<BallMovement>();
|
|
if (ballMovement != null)
|
|
{
|
|
// Debug.DrawRay(this.transform.position,this.transform.forward,Color.green,10);
|
|
var forward = this.transform.forward;
|
|
ballMovement.BounceTo(new Vector2(forward.x,forward.z));
|
|
}
|
|
}
|
|
}
|