1. svn -> git

This commit is contained in:
2017-04-12 01:23:07 +09:00
commit daaaf2997b
406 changed files with 68990 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
using UnityEngine;
[AddComponentMenu("Destructible 2D/D2D Top Down Gun")]
public class D2D_TopDownGun : MonoBehaviour
{
public GameObject Bullet;
public float ShotCooldown = 0.1f;
public float ShootSpeed = 10.0f;
public bool IsFiring;
private float cooldownTimer;
protected virtual void FixedUpdate()
{
if (IsFiring == true && Bullet != null && cooldownTimer <= 0.0f)
{
cooldownTimer = ShotCooldown;
var clone = D2D_Helper.CloneGameObject(Bullet, null, transform.position, transform.rotation);
var body = clone.GetComponent<Rigidbody2D>();
if (body != null)
{
body.velocity = transform.up * ShootSpeed;
}
}
}
protected virtual void Update()
{
cooldownTimer -= Time.deltaTime;
}
}