2019-08-04 00:59:18 +02:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Saltosion.OneWeapon.Bullets {
|
|
|
|
|
[RequireComponent(typeof(Bullet))]
|
|
|
|
|
public class RevolverBullet : MonoBehaviour {
|
|
|
|
|
|
|
|
|
|
public Rigidbody2D Body;
|
|
|
|
|
|
|
|
|
|
void Start() {
|
|
|
|
|
Vector2 Direction = GetComponent<Bullet>().Direction;
|
|
|
|
|
float Rot = GetComponent<Bullet>().InitialRotation;
|
|
|
|
|
|
|
|
|
|
Body.velocity = Direction * 15;
|
|
|
|
|
Body.rotation = Rot - 90;
|
|
|
|
|
}
|
2019-08-04 01:10:18 +02:00
|
|
|
|
|
|
|
|
|
void OnTriggerEnter2D(Collider2D collider) {
|
|
|
|
|
if (collider.GetComponent<Player>() != null) {
|
|
|
|
|
// don't hit the player!
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Destroy(gameObject);
|
|
|
|
|
Debug.Log("Boom!");
|
|
|
|
|
}
|
2019-08-04 00:59:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|