void OnCollisionEnter2D(Collision2D col) { if (col.gameObject.tag == "Ground") { Destroy(gameObject); } if (col.gameObject.tag == "UnityChan") { lifeScript.LifeDown(attackPoint); Destroy(gameObject); } }
void OnCollisionEnter2D(Collision2D col) { if (col.gameObject.tag == "UnityChan") { lifeScript.LifeDown(attacPoint); } }
void OnCollisionEnter2D(Collision2D col) { //Playerとぶつかった時 if (col.gameObject.tag == "Player") { //LifeScriptのLifeDownメソッドを実行 lifeScript.LifeDown(attackPoint); } }
void OnCollisionEnter2D(Collision2D col) { //UnityChanとぶつかった時 if (col.gameObject.tag == "UnityChan" && isHit == false && count == 0) { //LifeScriptのLifeDownメソッドを実行 lifeScript.LifeDown(attackPoint); count = 30; // 無敵時間をセット } }
public void skillGauge(int a) { if (gauge.getState() == false) { if (name == "x") { gauge.LifeDown(a + 50); } else if (name == "z") { gauge.LifeDown(a + 20); } } if (gauge.getState()) { kill = true; if (name == "z") { isKillTime = (int)Time.time; gauge.skill(); } } }
void Update() { Debug.Log(isGrounded); //着地判定 isGrounded = Physics2D.Linecast( transform.position + transform.up * 1, transform.position - transform.up * 0.05f, groundLayer); if (!gameClear) { //ジャンプボタン押下(スマホ対応) if (CrossPlatformInputManager.GetButtonDown("Jump")) { if (isGrounded) { anim.SetTrigger("Jump"); isGrounded = false; rigidbody2D.AddForce(Vector2.up * jumpPower); } } } //ジャンプアニメーション float velY = rigidbody2D.velocity.y; bool isJumping = velY > 0.1f ? true : false; bool isFalling = velY < -0.1f ? true : false; anim.SetBool("isJumping", isJumping); anim.SetBool("isFalling", isFalling); if (!gameClear) { //ショットボタン押下 if (CrossPlatformInputManager.GetButtonDown("Fire1")) { anim.SetTrigger("Shot"); Instantiate(bullet, transform.position + new Vector3(0f, 1.2f, 0f), Quaternion.identity); } //画面外に落ちた時にゲームオーバー if (gameObject.transform.position.y < Camera.main.transform.position.y - 8) { lifeScript.LifeDown(240); } } }