示例#1
0
 private void Update()
 {
     if (Input.GetButton("Fire1") && Time.time > normal_nextFire)//普通攻击
     {
         Storing_Time = 0;
         script_UI.UpdateStoringFire(0);
         normal_nextFire = Time.time + fireRate;
         Instantiate(shot_normal, shotposition.position, shotposition.rotation);
         GetComponent <AudioSource>().Play();
     }
     else if (Input.GetButton("Fire2") && Time.time > Storing_nextFire)/*蓄力,0.1秒检查一次*/
     {
         Debug.Log("out");
         Storing_nextFire = Time.time + 0.1f;
         Storing_Time    += 0.1f;
         script_UI.UpdateStoringFire(Storing_Time / Storing_interval);
     }
     else if (Input.GetButtonUp("Fire2"))//蓄力攻击
     {
         if (Storing_Time >= Storing_interval)
         {
             Instantiate(shot_storing, shotposition.position, shotposition.rotation);
             GetComponent <AudioSource>().Play();
         }
         Storing_Time = 0;
         script_UI.UpdateStoringFire(0);
     }
     else if (Input.GetButtonUp("Fire3"))//特殊攻击
     {
         if (Special_Num > 0)
         {
             Special_Num--;
             script_UI.UpdateSpecialFire(Special_Num);
             Instantiate(shot_speciall, shotposition.position, shotposition.rotation);
             GetComponent <AudioSource>().Play();
         }
     }
 }
示例#2
0
 void Start()
 {
     script_UI = obj_UI.GetComponent <UIControlScript>();
     script_UI.UpdateSpecialFire(Special_Num);
 }