void OnTriggerStay2D(Collider2D col)
 {
     if (atc.move_direction != 0)
     {
         return;
     }
     if (col.gameObject.tag == Common_data.PANDA_TAG)
     {
         panda_controller p_c = col.gameObject.GetComponent <panda_controller> ();
         if (p_c.move_direction > 0)
         {
             if (is_attact == true)
             {
                 return;
             }
         }
         else if (p_c.move_direction == 0)
         {
             is_attact = false;
             return;
         }
         else if (p_c.move_direction < 0)
         {
             return;
         }
         is_attact = true;
         bullet_controller b_c = bullet.GetComponent <bullet_controller>();
         b_c.move_direction = this.move_direction;
         atc.fire_attact();
         Instantiate(bullet, transform.position, bullet.transform.rotation);
     }
 }
Ejemplo n.º 2
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.tag == Common_data.PANDA_TAG)
        {
            if (is_compress == true)
            {
                return;
            }

            panda_controller panda            = col.gameObject.GetComponent <panda_controller>();
            GameObject       explode_instance = (GameObject)Instantiate(explode, panda.gameObject.transform.position, explode.transform.rotation);
            panda.dead();
        }
        else if (col.gameObject.tag == Common_data.MOVE_BLOCK_TAG || col.gameObject.tag == Common_data.BARREL_BLOCK_TAG)
        {
            is_compress = true;
            player.CrossFade("fire_down", 0);
        }
    }
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.tag == Common_data.BARELL_COLLIDER_TAG)
        {
            return;
        }
        //		checkCollider (col);
        else if (col.gameObject.tag == Common_data.PANDA_TAG)
        {
            float y = 0.0f;

            float x = 0.0f;

            panda_controller p_c = col.gameObject.GetComponent <panda_controller>();
            p_c.dead();
            boom();
        }
        else if (col.gameObject.tag == Common_data.MOVE_BLOCK_TAG || col.gameObject.tag == Common_data.BARREL_BLOCK_TAG)
        {
            boom();
        }
    }
	void Awake(){

		p = (panda_controller)transform.parent.gameObject.GetComponent<panda_controller>();

	}
Ejemplo n.º 5
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (move_direction == 0)
        {
            Debug.Log("dead tag _1is " + col.tag);
            Debug.Log("dead psotion is " + col.transform.position.x + "," + col.transform.position.y);
            if (col.gameObject.tag == Common_data.PANDA_TAG)
            {
                load_sound(SOUND_TYPE.hit);
                bar.enabled = false;
                player.CrossFade("dead_begin", 0);
                panda_controller p_c = col.gameObject.GetComponent <panda_controller> ();
                move_direction = p_c.move_direction;
                GameObject explode_instance = (GameObject)Instantiate(explode, my_transform.position, explode.transform.rotation);
                Debug.Log("panda move dead move is " + p_c.move_direction);
            }
            else if (col.gameObject.tag == Common_data.BARREL_BLOCK_TAG)
            {
                player.CrossFade("dead_begin", 0);
                load_sound(SOUND_TYPE.hit);
                bar.enabled = false;
                barrel_controller b_c = col.gameObject.GetComponent <barrel_controller> ();
                move_direction = b_c.move_direction;
                GameObject explode_instance = (GameObject)Instantiate(explode, my_transform.position, explode.transform.rotation);
            }
            else if (col.gameObject.tag == Common_data.MOVE_BLOCK_TAG)
            {
                player.CrossFade("dead_begin", 0);

                if (stand_direction == 1)
                {
                    last_move = 2;
                }
                else if (stand_direction == 2)
                {
                    last_move = 1;
                }
                else if (stand_direction == 3)
                {
                    last_move = 4;
                }
                else if (stand_direction == 4)
                {
                    last_move = 3;
                }
                player.CrossFade("dead_end", 0);
                move_direction = -1;
                dead_position  = my_transform.position;
                GameObject explode_instance = (GameObject)Instantiate(explode, my_transform.position, explode.transform.rotation);
                dead();
                Destroy(this.gameObject.GetComponent <BoxCollider2D>());
            }
        }
        else
        {
            Debug.Log("dead tag is " + col.gameObject.tag);

            if (col.tag == Common_data.BARELL_COLLIDER_TAG)
            {
                return;
            }


            if (move_direction == 1)
            {
                if (col.tag == Common_data.UP_BLOCK_TAG || col.tag == Common_data.LEFT_BLOCK_TAG || col.tag == Common_data.RIGHT_BLOCK_TAG || col.tag == Common_data.STREET_TAG)
                {
                    return;
                }
            }
            else if (move_direction == 2)
            {
                if (col.tag == Common_data.DOWN_BLOCK_TAG || col.tag == Common_data.LEFT_BLOCK_TAG || col.tag == Common_data.RIGHT_BLOCK_TAG || col.tag == Common_data.STREET_TAG)
                {
                    return;
                }
            }
            else if (move_direction == 3)
            {
                if (col.tag == Common_data.UP_BLOCK_TAG || col.tag == Common_data.LEFT_BLOCK_TAG || col.tag == Common_data.DOWN_BLOCK_TAG || col.tag == Common_data.STREET_TAG)
                {
                    return;
                }
            }
            else if (move_direction == 4)
            {
                if (col.tag == Common_data.UP_BLOCK_TAG || col.tag == Common_data.DOWN_BLOCK_TAG || col.tag == Common_data.RIGHT_BLOCK_TAG || col.tag == Common_data.STREET_TAG)
                {
                    return;
                }
            }


            player.CrossFade("dead_end", 0);
            last_move      = move_direction;
            move_direction = -1;
            dead_position  = my_transform.position;
            GameObject explode_instance = (GameObject)Instantiate(explode, dead_position, explode.transform.rotation);
            dead();

            Destroy(this.gameObject.GetComponent <BoxCollider2D>());
        }
    }
Ejemplo n.º 6
0
    void OnTriggerEnter2D(Collider2D col)
    {
        //		checkCollider (col);

        if (my_tag == LEFT_SPRING_TAG)
        {
            if ((col.gameObject.transform.position.y <= transform.position.y + 0.1 || col.gameObject.transform.position.y >= transform.position.y - 0.1) && col.gameObject.transform.position.x > transform.position.x + 0.5)
            {
                if (col.gameObject.tag == Common_data.PANDA_TAG)
                {
                    panda_controller p_c = col.gameObject.GetComponent <panda_controller>();

                    player.SetTrigger(IS_TRIGER);

                    col.gameObject.transform.position = transform.position + new Vector3(1.5f, 0f, 0f);
                    p_c.move(4);
                    Debug.Log("panda");
                }
                else if (col.gameObject.tag == Common_data.BARREL_BLOCK_TAG)
                {
                    player.SetTrigger(IS_TRIGER);
                    barrel_controller b_c = col.gameObject.GetComponent <barrel_controller>();
                    col.gameObject.transform.position = transform.position + new Vector3(1.5f, 0f, 0f);
                    b_c.move(4);
                }
            }
        }
        else if (my_tag == RIGHT_SPRING_TAG)
        {
            if ((col.gameObject.transform.position.y <= transform.position.y + 0.1 || col.gameObject.transform.position.y >= transform.position.y - 0.1) && col.gameObject.transform.position.x < transform.position.x - 0.5)
            {
                if (col.gameObject.tag == Common_data.PANDA_TAG)
                {
                    panda_controller p_c = col.gameObject.GetComponent <panda_controller>();

                    player.SetTrigger(IS_TRIGER);

                    col.gameObject.transform.position = transform.position + new Vector3(-1.5f, 0f, 0f);
                    p_c.move(3);
                    Debug.Log("panda");
                }
                else if (col.gameObject.tag == Common_data.BARREL_BLOCK_TAG)
                {
                    player.SetTrigger(IS_TRIGER);
                    barrel_controller b_c = col.gameObject.GetComponent <barrel_controller>();
                    col.gameObject.transform.position = transform.position + new Vector3(-1.5f, 0f, 0f);
                    b_c.move(3);
                }
            }
        }
        else if (my_tag == DOWN_SPRING_TAG)
        {
            if ((col.gameObject.transform.position.x <= transform.position.x + 0.1 || col.gameObject.transform.position.x >= transform.position.x - 0.1) && col.gameObject.transform.position.y > transform.position.y + 0.5)
            {
                if (col.gameObject.tag == Common_data.PANDA_TAG)
                {
                    panda_controller p_c = col.gameObject.GetComponent <panda_controller>();

                    player.SetTrigger(IS_TRIGER);

                    col.gameObject.transform.position = transform.position + new Vector3(0f, 1.5f, 0f);
                    p_c.move(1);
                    Debug.Log("panda");
                }
                else if (col.gameObject.tag == Common_data.BARREL_BLOCK_TAG)
                {
                    player.SetTrigger(IS_TRIGER);
                    barrel_controller b_c = col.gameObject.GetComponent <barrel_controller>();
                    col.gameObject.transform.position = transform.position + new Vector3(0f, 1.5f, 0f);
                    b_c.move(1);
                }
            }
        }
        else if (my_tag == UP_SPRING_TAG)
        {
            if ((col.gameObject.transform.position.x <= transform.position.x + 0.1 || col.gameObject.transform.position.x >= transform.position.x - 0.1) && col.gameObject.transform.position.y < transform.position.y - 0.5)
            {
                if (col.gameObject.tag == Common_data.PANDA_TAG)
                {
                    panda_controller p_c = col.gameObject.GetComponent <panda_controller>();

                    player.SetTrigger(IS_TRIGER);

                    col.gameObject.transform.position = transform.position + new Vector3(0f, -1.5f, 0f);
                    p_c.move(2);
                    Debug.Log("panda");
                }
                else if (col.gameObject.tag == Common_data.BARREL_BLOCK_TAG)
                {
                    player.SetTrigger(IS_TRIGER);
                    barrel_controller b_c = col.gameObject.GetComponent <barrel_controller>();
                    col.gameObject.transform.position = transform.position + new Vector3(0f, -1.5f, 0f);
                    b_c.move(2);
                }
            }
        }
    }
    void OnTriggerEnter2D(Collider2D col)
    {
        if (move_direction == 0)
        {
            if (col.gameObject.tag == Common_data.PANDA_TAG)
            {
                panda_controller p_c = col.gameObject.GetComponent <panda_controller> ();

                Debug.Log("panda collider");
                if (p_c.move_direction == 0)
                {
                    p_c.dead();
                    Instantiate(explode, p_c.gameObject.transform.position, explode.transform.rotation);
                    return;
                }
                load_sound(SOUND_TYPE.hit);
                move_direction = p_c.move_direction;
                initActionState();
                player.CrossFade("dead_begin", 0);

                Vector3 d = new Vector3();
                if (move_direction == 1)
                {
                    d = Vector3.up;
                }
                else if (move_direction == 2)
                {
                    d = Vector3.down;
                }
                else if (move_direction == 3)
                {
                    d = Vector3.left;
                }
                else if (move_direction == 4)
                {
                    d = Vector3.right;
                }


                my_transform.position = col.gameObject.transform.position + d;
                GameObject explode_instance = (GameObject)Instantiate(explode, my_transform.position, explode.transform.rotation);
                Debug.Log("panda move dead move is " + p_c.move_direction);
            }
            else if (col.gameObject.tag == Common_data.BARREL_BLOCK_TAG)
            {
                initActionState();
                player.CrossFade("dead_begin", 0);
                barrel_controller b_c = col.gameObject.GetComponent <barrel_controller> ();
                move_direction = b_c.move_direction;
                load_sound(SOUND_TYPE.hit);
                Vector3 d = new Vector3();
                if (move_direction == 1)
                {
                    d = Vector3.up;
                }
                else if (move_direction == 2)
                {
                    d = Vector3.down;
                }
                else if (move_direction == 3)
                {
                    d = Vector3.left;
                }
                else if (move_direction == 4)
                {
                    d = Vector3.right;
                }


                my_transform.position = col.gameObject.transform.position + d;
                GameObject explode_instance = (GameObject)Instantiate(explode, my_transform.position, explode.transform.rotation);
            }
        }
        else
        {
            Debug.Log("dead tag is " + col.gameObject.tag);
            if (col.tag == Common_data.BARELL_COLLIDER_TAG || col.tag == Common_data.TRAP_COLLIDER_TAG)
            {
                return;
            }
            if (move_direction == 1)
            {
                if (col.tag == Common_data.UP_BLOCK_TAG || col.tag == Common_data.LEFT_BLOCK_TAG || col.tag == Common_data.RIGHT_BLOCK_TAG || col.tag == Common_data.STREET_TAG)
                {
                    return;
                }
            }
            else if (move_direction == 2)
            {
                if (col.tag == Common_data.DOWN_BLOCK_TAG || col.tag == Common_data.LEFT_BLOCK_TAG || col.tag == Common_data.RIGHT_BLOCK_TAG || col.tag == Common_data.STREET_TAG)
                {
                    return;
                }
            }
            else if (move_direction == 3)
            {
                if (col.tag == Common_data.UP_BLOCK_TAG || col.tag == Common_data.LEFT_BLOCK_TAG || col.tag == Common_data.DOWN_BLOCK_TAG || col.tag == Common_data.STREET_TAG)
                {
                    return;
                }
            }
            else if (move_direction == 4)
            {
                if (col.tag == Common_data.UP_BLOCK_TAG || col.tag == Common_data.DOWN_BLOCK_TAG || col.tag == Common_data.RIGHT_BLOCK_TAG || col.tag == Common_data.STREET_TAG)
                {
                    return;
                }
            }


            initActionState();
            player.CrossFade("dead_end", 0);

            last_move      = move_direction;
            move_direction = -1;
            dead_position  = my_transform.position;
            GameObject explode_instance = (GameObject)Instantiate(explode, dead_position, explode.transform.rotation);
            dead();
            Destroy(this.gameObject.GetComponent <BoxCollider2D>());
        }
    }
Ejemplo n.º 8
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (move_direction == 0)
        {
            if (col.gameObject.tag == Common_data.PANDA_TAG)
            {
                initActionState();
                player.SetTrigger("dead_begin");
                panda_controller p_c = col.gameObject.GetComponent <panda_controller> ();
                move_direction = p_c.move_direction;
                load_sound(SOUND_TYPE.hit);
                GameObject explode_instance = (GameObject)Instantiate(explode, transform.position, explode.transform.rotation);
                Debug.Log("panda move dead move is " + p_c.move_direction);
            }
            else if (col.gameObject.tag == Common_data.BARREL_BLOCK_TAG)
            {
                initActionState();
                player.SetTrigger("dead_begin");
                barrel_controller b_c = col.gameObject.GetComponent <barrel_controller> ();
                move_direction = b_c.move_direction;
                load_sound(SOUND_TYPE.hit);
                GameObject explode_instance = (GameObject)Instantiate(explode, transform.position, explode.transform.rotation);
            }
            else if (col.gameObject.tag == Common_data.MOVE_BLOCK_TAG)
            {
                initActionState();

                move_block_controller m_b_c = col.gameObject.GetComponent <move_block_controller> ();
                last_move = m_b_c.move_direction;
                player.SetInteger(DEAD_MOVE, 2);
                move_direction = -1;
                dead_position  = transform.position;
                GameObject explode_instance = (GameObject)Instantiate(explode, transform.position, explode.transform.rotation);
                dead();
                Destroy(this.gameObject.GetComponent <BoxCollider2D>());
            }
        }
        else
        {
            Debug.Log("dead tag is " + col.gameObject.tag);
            if (col.tag == Common_data.BARELL_COLLIDER_TAG || col.tag == Common_data.TRAP_COLLIDER_TAG)
            {
                return;
            }
            if (move_direction == 1)
            {
                if (col.tag == Common_data.UP_BLOCK_TAG || col.tag == Common_data.LEFT_BLOCK_TAG || col.tag == Common_data.RIGHT_BLOCK_TAG || col.tag == Common_data.STREET_TAG)
                {
                    return;
                }
            }
            else if (move_direction == 2)
            {
                if (col.tag == Common_data.DOWN_BLOCK_TAG || col.tag == Common_data.LEFT_BLOCK_TAG || col.tag == Common_data.RIGHT_BLOCK_TAG || col.tag == Common_data.STREET_TAG)
                {
                    return;
                }
            }
            else if (move_direction == 3)
            {
                if (col.tag == Common_data.UP_BLOCK_TAG || col.tag == Common_data.LEFT_BLOCK_TAG || col.tag == Common_data.DOWN_BLOCK_TAG || col.tag == Common_data.STREET_TAG)
                {
                    return;
                }
            }
            else if (move_direction == 4)
            {
                if (col.tag == Common_data.UP_BLOCK_TAG || col.tag == Common_data.DOWN_BLOCK_TAG || col.tag == Common_data.RIGHT_BLOCK_TAG || col.tag == Common_data.STREET_TAG)
                {
                    return;
                }
            }


            initActionState();
            player.SetInteger(DEAD_MOVE, 2);
            last_move      = move_direction;
            move_direction = -1;
            dead_position  = transform.position;
            GameObject explode_instance = (GameObject)Instantiate(explode, dead_position, explode.transform.rotation);
            dead();
            Destroy(this.gameObject.GetComponent <BoxCollider2D>());
        }
    }
    void do_panda(Collider2D col)
    {
        bool isStop = false;

        if (move_direction == 1)
        {
            if ((col.gameObject.transform.position.x == transform.position.x) && (col.gameObject.transform.position.y > transform.position.y))
            {
                isStop             = true;
                transform.position = col.gameObject.transform.position + Vector3.down;
            }
            else
            {
                isStop = false;
            }
        }
        else if (move_direction == 2)
        {
            if ((col.gameObject.transform.position.x == transform.position.x) && (col.gameObject.transform.position.y < transform.position.y))
            {
                isStop             = true;
                transform.position = col.gameObject.transform.position + Vector3.up;
                Debug.Log("down");
            }
            else
            {
                isStop = false;
            }
        }
        else if (move_direction == 3)
        {
            if ((col.gameObject.transform.position.y == transform.position.y) && (col.gameObject.transform.position.x < transform.position.x))
            {
                isStop             = true;
                transform.position = col.gameObject.transform.position + Vector3.right;
            }
            else
            {
                isStop = false;
            }
        }
        else if (move_direction == 4)
        {
            if ((col.gameObject.transform.position.y == transform.position.y) && (col.gameObject.transform.position.x > transform.position.x))
            {
                isStop             = true;
                transform.position = col.gameObject.transform.position + Vector3.left;
            }
            else
            {
                isStop = false;
            }
        }

        if (isStop == true)
        {
            panda_controller p_c = col.gameObject.GetComponent <panda_controller>();
            p_c.push_move(move_direction);

            move_direction = 0;
        }
    }
Ejemplo n.º 10
0
 void Awake()
 {
     p = (panda_controller)transform.parent.gameObject.GetComponent <panda_controller>();
 }
Ejemplo n.º 11
0
    void OnTriggerEnter2D(Collider2D col)
    {
        Debug.Log("attact tag is " + col.tag);

        if (col.gameObject.tag == Common_data.PANDA_TAG)
        {
            explode_effect(col);
            panda_controller p_c = col.gameObject.GetComponent <panda_controller>();
            p_c.dead();
            load_sound();
            dead();
        }
        else if (col.gameObject.tag == Common_data.ICE_BLOCK_TAG)
        {
            explode_effect(col);
            dead();
            ice_controller i_c = col.gameObject.GetComponent <ice_controller>();
            i_c.attact();
        }
        else if (col.gameObject.tag == Common_data.UP_BLOCK_TAG)
        {
            if (move_direction == 1)
            {
                unidirection_controller u_c = col.gameObject.GetComponent <unidirection_controller>();
                u_c.open_door();
            }
            else if (move_direction == 2)
            {
                explode_effect(col);
                load_sound();
                dead();
            }
            else
            {
                return;
            }
        }
        else if (col.gameObject.tag == Common_data.DOWN_BLOCK_TAG)
        {
            if (move_direction == 1)
            {
                explode_effect(col);
                load_sound();
                dead();
            }
            else if (move_direction == 2)
            {
                unidirection_controller u_c = col.gameObject.GetComponent <unidirection_controller>();
                u_c.open_door();
            }
            else
            {
                return;
            }
        }
        else if (col.gameObject.tag == Common_data.LEFT_BLOCK_TAG)
        {
            if (move_direction == 3)
            {
                unidirection_controller u_c = col.gameObject.GetComponent <unidirection_controller>();
                u_c.open_door();
            }
            else if (move_direction == 4)
            {
                explode_effect(col);
                load_sound();
                dead();
            }
            else
            {
                return;
            }
        }
        else if (col.gameObject.tag == Common_data.RIGHT_BLOCK_TAG)
        {
            if (move_direction == 4)
            {
                unidirection_controller u_c = col.gameObject.GetComponent <unidirection_controller>();
                u_c.open_door();
            }
            else if (move_direction == 3)
            {
                explode_effect(col);
                load_sound();
                dead();
            }
            else
            {
                return;
            }
        }
        else
        {
            if (col.gameObject.tag != Common_data.BARELL_COLLIDER_TAG && col.gameObject.tag != Common_data.ATTACT_ENEMY_TAG && col.gameObject.tag != Common_data.STREET_TAG && col.gameObject.tag != "trap_collider" && col.gameObject.tag != "trap" && col.gameObject.tag != Common_data.BULLET_TAG)
            {
                explode_effect(col);
                load_sound();
                dead();
            }
        }
    }