public GameObject getBullet(tankType type) { if (freeBullets.Count == 0) { GameObject newBullet = Instantiate(bullet); newBullet.GetComponent <Bullet>().setTankType(type); usingBullets.Add(newBullet.GetInstanceID(), newBullet); return(newBullet); } foreach (KeyValuePair <int, GameObject> pair in freeBullets) { pair.Value.SetActive(true); pair.Value.GetComponent <Bullet>().setTankType(type); freeBullets.Remove(pair.Key); usingBullets.Add(pair.Key, pair.Value); return(pair.Value); } return(null); }
public GameObject getBullet(tankType type) { if (freeBullets.Count == 0) { GameObject newBullet = Instantiate(Resources.Load <GameObject>("Prefabs/Shell"), new Vector3(0, 0, 0), Quaternion.identity) as GameObject; newBullet.GetComponent <Bullet>().setTankType(type); newBullet.tag = "bullet"; bullets.Add(newBullet.GetInstanceID(), newBullet); return(newBullet); } foreach (KeyValuePair <int, GameObject> pair in freeBullets) { pair.Value.SetActive(true); pair.Value.GetComponent <Bullet>().setTankType(type); freeBullets.Remove(pair.Key); bullets.Add(pair.Key, pair.Value); return(pair.Value); } return(null); }
public void setTankType(tankType type) { this.type = type; }
public void SetTankType(tankType type) //设置发射子弹的坦克类型 { this.type = type; }
public void setTankType(tankType type) {//设置发射子弹的坦克类型 this.type = type; }
public void setTankType(tankType _type) { type = _type; }