IEnumerator chooseAttack() { yield return(new WaitForSeconds(attackSec)); float whichAct; whichAct = Random.Range(0, 4); Debug.Log("The Attack Choice is:" + whichAct); if (whichAct < 1) { m_BossState = Bstate.Attack1; } else if (whichAct >= 1 && whichAct < 2) { m_BossState = Bstate.Attack2; } else if (whichAct >= 2 && whichAct < 3) { m_BossState = Bstate.Attack3; } else if (whichAct >= 3) { m_BossState = Bstate.Attack4; } onlyOnce = true; }
IEnumerator FinishAttack1() { yield return(new WaitForSeconds(attackLength [0])); Debug.Log("Attack1 is done"); Body_Ani.SetBool("Attack1", false); m_BossState = Bstate.Idle; onlyOnce = true; }
//private float attackLastSec; // Use this for initialization void Start() { m_BossState = Bstate.Idle; m_BossBody = GameObject.Find("2ndBossBodyCtrl"); Body_Ani = m_BossBody.GetComponent <Animator> (); //m_Boss = GameObject.Find ("UFO_Body"); m_SBS = m_Boss.GetComponent <SecBossSound> (); Debug.Log(m_SBS.gameObject.name); //m_BossRay = GameObject.Find ("BossRay"); m_BossRay.SetActive(false); m_Transform = this.gameObject.GetComponent <Transform> (); p_Trasnform = GameObject.Find("Player").GetComponent <Transform> (); BossSprite = m_Boss.GetComponent <SpriteRenderer> (); onlyOnce = true; }
IEnumerator FinishAttack3() { yield return(new WaitForSeconds(attackLength [2])); m_SBS.Pause(); Debug.Log("Attack3 or 4 is done"); Body_Ani.SetTrigger("Attack2"); m_BossState = Bstate.Idle; updatedPos = new Vector3(p_Trasnform.transform.position.x, p_Trasnform.transform.position.y + 2f); this.gameObject.GetComponent <Transform> ().position = updatedPos; m_BossRay.SetActive(false); isIdle = true; isHorizontalBeamR = false; onlyOnce = true; }
//图书查询 private void button1_Click(object sender, EventArgs e) { SqlConnection conn = SQLbase.getConn(); try { this.datagridview.Rows.Clear(); if (conn.State == ConnectionState.Open) { conn.Close(); } //打开连接 conn.Open(); string selectStr = "select * from books"; //按书号查询 if (comboBox_QueryStyle.SelectedIndex == 0) { string bid = txt_query.Text.ToString(); //建立查询命令 selectStr = "select * from books where BID=" + bid; } //按书名查询 else if (comboBox_QueryStyle.SelectedIndex == 1) { string bname = txt_query.Text.ToString(); //建立查询命令 selectStr = "select * from books where Bname= '" + bname + "'"; } //按作者查询 else if (comboBox_QueryStyle.SelectedIndex == 2) { string bauthor = txt_query.Text.ToString(); //建立查询命令 selectStr = "select * from books where Bauthor= '" + bauthor + "'"; } //按出版社查询 else if (comboBox_QueryStyle.SelectedIndex == 3) { string bpublisher = txt_query.Text.ToString(); //建立查询命令 selectStr = "select * from books where Bpublisher= '" + bpublisher + "'"; } //没有选择下拉框,则查询全部 SqlCommand SelectCmd = new SqlCommand(selectStr, conn); SqlDataReader datareader = SelectCmd.ExecuteReader(); string Bid, Bname, Bauthor, Bpublisher, Btype, Bstate; int rowindex = 0; this.datagridview.Rows.Clear(); while (datareader.Read()) { Bid = datareader["BID"].ToString(); Bname = datareader["Bname"].ToString(); Bauthor = datareader["Bauthor"].ToString(); Bpublisher = datareader["Bpublisher"].ToString(); Btype = datareader["Btype"].ToString(); Bstate = datareader["Bstate"].ToString(); rowindex = this.datagridview.Rows.Add(); //trim函数同于去除字符串两头的空格 this.datagridview.Rows[rowindex].Cells[0].Value = Bid.Trim(); this.datagridview.Rows[rowindex].Cells[1].Value = Bname.Trim(); this.datagridview.Rows[rowindex].Cells[2].Value = Bauthor.Trim(); this.datagridview.Rows[rowindex].Cells[3].Value = Bpublisher.Trim(); this.datagridview.Rows[rowindex].Cells[4].Value = Btype.Trim(); this.datagridview.Rows[rowindex].Cells[5].Value = Bstate.Trim(); } } catch { MessageBox.Show("查无此书!"); } SQLbase.close(conn); }