Unity 弾発射制限
自分用メモ
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
public class TamaSeigen : MonoBehaviour {
public BulletScript bulletScript;
RectTransform rt;
public float life_time = 1.5f;
float time = 0f;
IEnumerator Start ()
{
rt = GetComponent
for(;;){
if (rt.sizeDelta.y <= 240) {
LifeDown (-10);
}
// 秒待つ
yield return new WaitForSeconds (1f);
}
}
void Update ()
{
//
if (rt.sizeDelta.y > 80) {
if (Input.GetKeyDown ("x")) {
LifeDown (80);
}
bulletScript.utuzo (0);
} else {
bulletScript.utuzo (1);
}
time += Time.deltaTime;
if(time>life_time){
}
}
public void LifeDown (int ap)
{
rt.sizeDelta -= new Vector2 (0,ap);
}
}