Beispiel #1
0
    //void StopChase()
    //{
    //    if(isHate)
    //    {
    //        if((transform.position-target.transform.position).magnitude>LoveRange)
    //        {
    //            isHate = false;
    //            Move(new Vector2(0, 0));
    //        }
    //    }
    //}

    protected void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            Player player = collision.gameObject.GetComponent <Player>();
            if (player.isPowerUP)
            {
                SoundMgr.Instance().PlaySoundEffect(3);
                // 揍飞
                isfly = true;
                GetComponent <CircleCollider2D>().enabled = false;
                Vector2 dir = player.rg.velocity;
                Move(dir * fly_speed);

                // 特效
                GameObject a = Instantiate(effect, transform.position, Quaternion.identity);
                Destroy(a, 0.4f);

                LevelPanel.levelPanel.BottomFrame();
                LevelPanel.levelPanel.ShakeObj(transform);



                //得分
                Point.AddPoint(100 * player.kill_number);
                player.kill_number++;
            }
            else
            {
                player.Damage(attack);
            }
        }
    }
Beispiel #2
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            Player player = collision.gameObject.GetComponent <Player>();
            if (player.isPowerUP)
            {
                SoundMgr.Instance().PlaySoundEffect(2);
                // 揍飞
                isfly = true;
                GetComponent <CircleCollider2D>().enabled = false;
                Vector2 dir = player.rg.velocity;
                if (dir.magnitude < 1)
                {
                    dir *= 1 / dir.magnitude;
                }
                rg.constraints = RigidbodyConstraints2D.None;
                rg.velocity    = dir * fly_speed;

                rotate_speed = 100f;

                //顿帧
                LevelPanel.levelPanel.BottomFrame();
                LevelPanel.levelPanel.ShakeObj(transform);
            }
        }
    }
Beispiel #3
0
    // 变身无敌
    public void PowerUP()
    {
        isPowerUP = true;
        LevelPanel.levelPanel.WarePant();
        m_winTime = Time.time + 5;
        SoundMgr.Instance().PlaySoundEffect(1);
        pant.SetActive(true);
        //GetComponent<SpriteRenderer>().color = Color.red;

        Camera.main.GetComponent <LightControl>().PowerUPLight();
    }
Beispiel #4
0
    public void Show(bool isWin)
    {
        win_img.enabled = isWin;
        win_btn.SetActive(isWin);
        fail_text.SetActive(!isWin);
        fail_btn.SetActive(!isWin);

        if (isWin)
        {
            SoundMgr.Instance().PlaySoundEffect(4);
        }
        else
        {
            SoundMgr.Instance().PlaySoundEffect(0);
        }
    }
Beispiel #5
0
    new void Update()
    {
        base.Update();
        MoveUpdate();
        updateHpBar();

        if (m_winTime != 0 && Time.time > m_winTime)
        {
            LevelPanel.levelPanel.GameWin();
            m_winTime = 0;
        }

        if (Input.GetKeyDown(KeyCode.E))
        {
            m_animator.SetTrigger("piaorou");
            SoundMgr.Instance().PlaySoundEffect(1);
        }
    }
Beispiel #6
0
 public void OnStartBtn()
 {
     SceneManager.LoadScene(1);
     LevelPanel.levelPanel.gameObject.SetActive(true);
     SoundMgr.Instance().PlaySoundEffect(1);
 }