Ejemplo n.º 1
0
    void OnTriggerStay2D(Collider2D collider)
    {
        GameObject mgo      = collider.gameObject;
        bool       isbullet = false;
        bool       dam      = false;

        if (collider.tag == "Enermy")
        {
            mgo      = collider.gameObject;
            isbullet = false;
            dam      = true;
        }
        else if (collider.tag == "Bullet")
        {
            mgo      = collider.gameObject;
            isbullet = true;
            dam      = true;
        }
        else if (collider.tag == "Budy")
        {
            mgo = collider.gameObject;
            while (mgo.tag != "Enermy")
            {
                mgo = mgo.transform.parent.gameObject;
            }
            isbullet = false;
            dam      = true;
        }

        if (dam)
        {
            powercount = 0;
            //GameObject.Destroy(GameObject.Find("PowerUp1(Clone)"));
            //GameObject.Destroy(GameObject.Find("PowerUp2(Clone)"));
            powerup1 = false;
            powerup2 = false;
            if (animator.GetCurrentAnimatorStateInfo(0).IsName("Dash") && dogetime > 0)
            {
                bool exist = false;
                for (int i = 0; i < DogedList.Count; i++)
                {
                    if ((GameObject)DogedList [i] == mgo)
                    {
                        exist = true;
                    }
                }
                if (!exist)
                {
                    skc.DoDodgeSkill(isbullet, mgo);
                    dogetime = dogetime - 1;
                    DogedList.Add(mgo);
                    //触发闪避效果
                    //触发闪避特效
                    //将go添加到队列中
                }
            }
            else
            {
                hit = true;
                if (damtimecount <= 50 && nothing == false)
                {
                    skc.Dmg(isbullet, mgo);
                    nothing = true;
                }
            }
        }
    }