示例#1
0
 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);
 }
示例#2
0
 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);
 }
示例#3
0
 public void setTankType(tankType type)
 {
     this.type = type;
 }
示例#4
0
 public void SetTankType(tankType type)      //设置发射子弹的坦克类型
 {
     this.type = type;
 }
示例#5
0
 public void setTankType(tankType type)
 {//设置发射子弹的坦克类型
     this.type = type;
 }
示例#6
0
 public void setTankType(tankType _type)
 {
     type = _type;
 }