39 lines
977 B
C#
39 lines
977 B
C#
![]() |
using UnityEngine;
|
||
|
|
||
|
public class Skywalker_BlueberryBlast : MonoBehaviour
|
||
|
{
|
||
|
public float speed = 10f;
|
||
|
public float lifeTime = 3f;
|
||
|
|
||
|
private Vector3 moveDirection;
|
||
|
|
||
|
void Start()
|
||
|
{
|
||
|
// Move direction should be based on spawn rotation (ShootPoint's forward/right)
|
||
|
moveDirection = transform.forward;
|
||
|
|
||
|
Destroy(gameObject, lifeTime);
|
||
|
}
|
||
|
|
||
|
void Update()
|
||
|
{
|
||
|
transform.position += moveDirection * speed * Time.deltaTime;
|
||
|
}
|
||
|
|
||
|
void OnTriggerEnter(Collider col)
|
||
|
{
|
||
|
Debug.Log("Skywalker_BlueberryBlast Triggered with: "+col.gameObject.name);
|
||
|
Skywalker_BreakableWall wall = col.GetComponent<Skywalker_BreakableWall>();
|
||
|
if (wall != null)
|
||
|
{
|
||
|
Debug.Log("Skywalker_BlueberryBlast Wall: " + wall);
|
||
|
wall.BreakWall();
|
||
|
Destroy(gameObject);
|
||
|
}
|
||
|
//else if (!col.CompareTag("Player"))
|
||
|
//{
|
||
|
// Destroy(gameObject);
|
||
|
//}
|
||
|
}
|
||
|
}
|