void OnCollisionStay(Collision other)
    {
        // おににぶつかったら、減速する.
        //

        if (other.gameObject.tag == "OniGroup")
        {
            if (this.step != STEP.MISS)
            {
                this.next_step = STEP.MISS;

                // プレイヤーがおににぶつかったときの処理.

                this.scene_control.OnPlayerMissed();

                // おにグループに、プレイヤーがぶつかったことを覚えておく.

                OniGroupControl oni_group = other.gameObject.GetComponent <OniGroupControl>();

                oni_group.onPlayerHitted();
            }
        }

        // 着地してる?.
        if (other.gameObject.tag == "Floor")
        {
            this.is_contact_floor = true;
        }
    }
    void OnCollisionStay(Collision other)
    {
        // 和怪物接触后,减速
        //

        if (other.gameObject.tag == "OniGroup")
        {
            do
            {
                // 攻击判定过程中不可能出现Miss
                if (this.attack_timer > 0.0f)
                {
                    break;
                }

                if (this.step == STEP.MISS)
                {
                    break;
                }

                //

                this.next_step = STEP.MISS;

                // 玩家和怪物接触时的处理

                this.scene_control.OnPlayerMissed();

                // 记录下怪物小组和玩家发生了接触

                OniGroupControl oni_group = other.gameObject.GetComponent <OniGroupControl>();

                oni_group.onPlayerHitted();
            } while(false);
        }

        // 是否着陆了?
        if (other.gameObject.tag == "Floor")
        {
            if (other.relativeVelocity.y >= Physics.gravity.y * Time.deltaTime)
            {
                this.is_contact_floor = true;
            }
        }
    }
Exemple #3
0
    void OnCollisionStay(Collision other)
    {
        // おににぶつかったら、減速する.
        //

        if (other.gameObject.tag == "OniGroup")
        {
            do
            {
                // 攻撃判定発生中はミスにならない.
                if (this.attack_timer > 0.0f)
                {
                    break;
                }

                if (this.step == STEP.MISS)
                {
                    break;
                }

                //

                this.next_step = STEP.MISS;

                // プレイヤーがおににぶつかったときの処理.

                this.scene_control.OnPlayerMissed();

                // おにグループに、プレイヤーがぶつかったことを覚えておく.

                OniGroupControl oni_group = other.gameObject.GetComponent <OniGroupControl>();

                oni_group.onPlayerHitted();
            } while(false);
        }

        // 着地してる?.
        if (other.gameObject.tag == "Floor")
        {
            if (other.relativeVelocity.y >= Physics.gravity.y * Time.deltaTime)
            {
                this.is_contact_floor = true;
            }
        }
    }