arkanoid/Assets/Scripts/WallBouncer.cs
2021-03-18 13:57:21 +01:00

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));
}
}
}