예제 #1
0
 void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.tag == "Ground")
     {
         Destroy(gameObject);
     }
     if (col.gameObject.tag == "UnityChan")
     {
         lifeScript.LifeDown(attackPoint);
         Destroy(gameObject);
     }
 }
예제 #2
0
 void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.tag == "UnityChan")
     {
         lifeScript.LifeDown(attacPoint);
     }
 }
예제 #3
0
 void OnCollisionEnter2D(Collision2D col)
 {
     //Playerとぶつかった時
     if (col.gameObject.tag == "Player")
     {
         //LifeScriptのLifeDownメソッドを実行
         lifeScript.LifeDown(attackPoint);
     }
 }
예제 #4
0
 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();
            }
        }
    }
예제 #6
0
    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);
            }
        }
    }