Ejemplo n.º 1
0
 public override void be_hit(mario_obj obj)
 {
     if (obj.m_main)
     {
         bool        flag = false;
         mario_point p    = utils.get_rxy(m_d);
         for (int i = 0; i < m_s.Count; ++i)
         {
             int left   = p.x * i * 320 / 1000 - 100 + m_pos.x;
             int right  = p.x * i * 320 / 1000 + 100 + m_pos.x;
             int top    = p.y * i * 320 / 1000 + 100 + m_pos.y;
             int bottom = p.y * i * 320 / 1000 - 100 + m_pos.y;
             if (right >= obj.m_bound.left && left <= obj.m_bound.right && top >= obj.m_bound.bottom && bottom <= obj.m_bound.top)
             {
                 if (i - 6 >= m_param [0] / 2)
                 {
                     break;
                 }
                 flag = true;
                 break;
             }
         }
         if (flag)
         {
             obj.set_bl(0, 4);
         }
     }
 }
Ejemplo n.º 2
0
    public override void reset()
    {
        if (m_velocity.x == 0 && m_velocity.y == 0)
        {
            return;
        }
        if (m_pos.x == m_velocity.x && m_pos.y == m_velocity.y)
        {
            m_velocity.x = m_pos.x + 1;
            m_velocity.y = m_pos.y + 1;
        }
        m_dir.x = m_velocity.x - m_pos.x;
        m_dir.y = m_velocity.y - m_pos.y;
        if (m_dir.x > 10000 || m_dir.x < -10000 || m_dir.y > 10000 || m_dir.y < -10000)
        {
            m_is_destory = 1;
            return;
        }
        int yz = (int)Mathf.Sqrt((float)(m_dir.x * m_dir.x + m_dir.y * m_dir.y));

        m_dir.x    = m_dir.x * 4000 / yz;
        m_dir.y    = m_dir.y * 4000 / yz;
        m_yz.x     = m_pos.x * 100;
        m_yz.y     = m_pos.y * 100;
        m_velocity = new mario_point();
    }
Ejemplo n.º 3
0
 public void update_ex(mario_point roll)
 {
     for (int i = 0; i < m_cengs.Count; ++i)
     {
         int x = (roll.x / 10 / m_moves[i]) % m_lens[i];
         int y = roll.y / 10 / m_moves[i];
         m_cengs[i].transform.localPosition = new Vector3(-x, -y);
     }
 }
Ejemplo n.º 4
0
    public override mario_point move()
    {
        mario_point p = new mario_point();

        if (m_state)
        {
            p.y      = -50;
            m_pos.y -= 50;
        }
        return(p);
    }
Ejemplo n.º 5
0
    public override mario_point move()
    {
        mario_point p = new mario_point();

        if (m_param[0] == 2)
        {
            if (m_state == 1)
            {
                p.y      = -50;
                m_pos.y -= 50;
            }
        }
        else
        {
            int yx = 60;
            if (m_time < 60)
            {
                yx = m_time;
            }
            else if (m_time > 140)
            {
                yx = 200 - m_time;
            }
            if (m_state == 0)
            {
                yx = -yx;
            }
            m_time++;
            if (m_time >= 200)
            {
                m_time  = 0;
                m_state = 1 - m_state;
            }

            if (m_param[0] == 0)
            {
                m_p.x += yx;
                int dx = m_p.x / 2 - m_pos.x;
                p.x      = dx;
                m_pos.x += dx;
            }
            else
            {
                m_p.y += yx;
                int dy = m_p.y / 2 - m_pos.y;
                p.y      = dy;
                m_pos.y += dy;
            }
        }
        return(p);
    }
Ejemplo n.º 6
0
    public override mario_point move()
    {
        mario_point p = new mario_point();

        if (m_param[0] == 0)
        {
            p.x = 50;
        }
        else
        {
            p.x = -50;
        }
        return(p);
    }
Ejemplo n.º 7
0
    public override void tupdate()
    {
        if (m_is_die)
        {
            m_velocity.x  = 0;
            m_velocity.y -= utils.g_g;
        }
        else
        {
            if (play_mode._instance.m_main_char != null)
            {
                int x = play_mode._instance.m_main_char.m_pos.x;
                int y = play_mode._instance.m_main_char.m_pos.y;
                x = x - m_pos.x;
                y = y - m_pos.y;

                int r1 = utils.atan(x, y);
                int r2 = utils.atan(m_dir.x, m_dir.y);

                if (r1 < r2)
                {
                    int r = r2 - r1;
                    if (r < 180)
                    {
                        r2 = r2 - 1;
                    }
                    else
                    {
                        r2 = r2 + 1;
                    }
                }
                else
                {
                    int r = r1 - r2;
                    if (r < 180)
                    {
                        r2 = r2 + 1;
                    }
                    else
                    {
                        r2 = r2 - 1;
                    }
                }
                r2    = (r2 + 360) % 360;
                m_dir = utils.tan(r2);
            }
            set_vr();
        }
    }
Ejemplo n.º 8
0
    void refresh(int d)
    {
        mario_point p = utils.get_rxy(d);

        for (int i = 0; i < m_s.Count; ++i)
        {
            m_s[i].transform.localPosition    = new Vector3(p.x * i * 32 / 1000, p.y * i * 32 / 1000);
            m_s[i].transform.localEulerAngles = new Vector3(0, 0, -d * 20);
        }
        if (m_shadow != null)
        {
            for (int i = 0; i < m_s.Count; ++i)
            {
                m_shadow.GetComponent <mario_huogun_ex>().m_s[i].transform.localPosition    = new Vector3(p.x * i * 32 / 1000, p.y * i * 32 / 1000);
                m_shadow.GetComponent <mario_huogun_ex>().m_s[i].transform.localEulerAngles = new Vector3(0, 0, -d * 20);
            }
        }
    }
Ejemplo n.º 9
0
    public void check_is_start(mario_point grid)
    {
        int x = m_grid.x - grid.x;
        int y = m_grid.y - grid.y;

        if (m_unit == null)
        {
            m_is_start = true;
        }
        if (m_main)
        {
            m_is_start = true;
        }
        else if (x >= -utils.g_start_x && x <= utils.g_start_x && y >= -utils.g_start_y && y <= utils.g_start_y)
        {
            m_is_start = true;
        }
        else if (x < -utils.g_del_x || x > utils.g_del_x || y < -utils.g_del_y || y > utils.g_del_y)
        {
            m_is_start = false;
        }
    }
Ejemplo n.º 10
0
 public mario_point get_nl_calc_point()
 {
     if (m_is_calc_nl)
     {
         return(m_nl_calc_point);
     }
     if (m_bnl_objs.Count > 0)
     {
         int xx1 = 0;
         int xx2 = 0;
         int yy  = -999999;
         for (int i = 0; i < m_bnl_objs.Count; ++i)
         {
             mario_point p = m_bnl_objs[i].get_nl_calc_point();
             if (p.x > 0 && p.x > xx1)
             {
                 xx1 = p.x;
             }
             if (p.x < 0 && p.x < xx2)
             {
                 xx2 = p.x;
             }
             if (p.y > yy)
             {
                 yy = p.y;
             }
         }
         int xx = xx1 + xx2;
         m_nl_calc_point = new mario_point(m_velocity.x + xx, m_velocity.y + yy);
     }
     else
     {
         m_nl_calc_point = new mario_point(m_velocity.x, m_velocity.y);
     }
     m_is_calc_nl = true;
     return(m_nl_calc_point);
 }
Ejemplo n.º 11
0
    public override mario_point move()
    {
        mario_point p = new mario_point();

        if (m_hit)
        {
            m_hit_time++;
            if (m_hit_time < 5)
            {
                return(p);
            }
            if (m_param[0] == 0)
            {
                p.x      = 50;
                m_pos.x += 50;
            }
            else
            {
                p.x      = -50;
                m_pos.x -= 50;
            }
        }
        return(p);
    }
Ejemplo n.º 12
0
 public void update_ex(mario_point grid)
 {
     if (!m_edit_mode)
     {
         check_state(grid);
         tupdate();
     }
     if (m_edit_mode && m_has_edit)
     {
         play_anim("edit");
     }
     if (m_per_pos.x != m_pos.x || m_per_pos.y != m_pos.y)
     {
         set_pos();
     }
     if (m_no_mc_time > 0)
     {
         m_no_mc_time--;
     }
     record_per();
     m_nl_objs.Clear();
     m_bnl_objs.Clear();
     m_is_calc_nl = false;
 }
Ejemplo n.º 13
0
 public void do_move()
 {
     m_is_calc_nl    = true;
     m_nl_calc_point = move();
 }
Ejemplo n.º 14
0
    public void message(s_message message)
    {
        if (message.m_type == "play_win")
        {
            m_win = 0;
            if (mario._instance.m_game_state == e_game_state.egs_play)
            {
                List <int> input = (List <int>)message.m_object[0];
                protocol.game.cmsg_complete_map msg = new protocol.game.cmsg_complete_map();
                msg.suc   = 0;
                msg.point = (int)message.m_ints[0];
                msg.time  = (int)message.m_ints[1];
                msg.video = game_data._instance.save_inputs(input);
                net_http._instance.send_msg <protocol.game.cmsg_complete_map>(opclient_t.OPCODE_COMPLETE_MAP, msg);
            }
            else if (mario._instance.m_game_state == e_game_state.egs_review)
            {
                mario._instance.change_state(e_game_state.egs_play_select, 1, delegate() { this.gameObject.SetActive(false); });
            }
            else if (mario._instance.m_game_state == e_game_state.egs_edit)
            {
            }
            else if (mario._instance.m_game_state == e_game_state.egs_edit_play)
            {
                mario._instance.change_state(e_game_state.egs_edit_select, 1, delegate() { this.gameObject.SetActive(false); });
            }
            else if (mario._instance.m_game_state == e_game_state.egs_edit_upload)
            {
                s_message mes = new s_message();
                mes.m_type = "play_gui_uplw_ok";
                mes.m_object.Add(message);
                s_message mes1 = new s_message();
                mes1.m_type = "play_gui_uplw_cancel";
                mario._instance.show_double_dialog_box(game_data._instance.get_language_string("play_gui_uplw"), mes, mes1);
            }
            else if (mario._instance.m_game_state == e_game_state.egs_br_play)
            {
                protocol.game.cmsg_mission_success msg = new protocol.game.cmsg_mission_success();
                msg.point = (int)message.m_ints[0];
                msg.time  = (int)message.m_ints[1];
                net_http._instance.send_msg <protocol.game.cmsg_mission_success>(opclient_t.OPCODE_MISSION_SUCCESS, msg);
            }
        }
        if (message.m_type == "play_lose")
        {
            m_win = 1;
            if (mario._instance.m_game_state == e_game_state.egs_play)
            {
                mario_point p = (mario_point)message.m_object[0];
                protocol.game.cmsg_complete_map msg = new protocol.game.cmsg_complete_map();
                msg.suc = 1;
                msg.x   = p.x;
                msg.y   = p.y;
                net_http._instance.send_msg <protocol.game.cmsg_complete_map>(opclient_t.OPCODE_COMPLETE_MAP, msg);
            }
            else if (mario._instance.m_game_state == e_game_state.egs_review)
            {
                mario._instance.change_state(e_game_state.egs_play_select, 1, delegate() { this.gameObject.SetActive(false); });
            }
            else if (mario._instance.m_game_state == e_game_state.egs_edit)
            {
            }
            else if (mario._instance.m_game_state == e_game_state.egs_edit_play)
            {
                m_play_lose.SetActive(true);
            }
            else if (mario._instance.m_game_state == e_game_state.egs_edit_upload)
            {
                m_play_lose.SetActive(true);
            }
            else if (mario._instance.m_game_state == e_game_state.egs_br_play)
            {
                mario_point p = (mario_point)message.m_object[0];
                protocol.game.cmsg_mission_fail msg = new protocol.game.cmsg_mission_fail();
                msg.x = p.x;
                msg.y = p.y;
                net_http._instance.send_msg <protocol.game.cmsg_mission_fail>(opclient_t.OPCODE_MISSION_FAIL, msg);
            }
        }
        if (message.m_type == "add_score")
        {
            int        x   = (int)message.m_ints[0];
            int        y   = (int)message.m_ints[1];
            int        s   = (int)message.m_ints[2];
            GameObject obj = (GameObject)Instantiate(m_score_sub);
            obj.transform.parent        = m_score_panel.transform;
            obj.transform.localPosition = new Vector3(x, y, 0);
            obj.transform.localScale    = new Vector3(1, 1, 1);
            obj.GetComponent <score>().reset(s);
            obj.SetActive(true);
            m_scores.Add(obj);
        }
        if (message.m_type == "time_up")
        {
            m_time_up.SetActive(true);
        }
        if (message.m_type == "play_gui_uplw_ok")
        {
            s_message  mes   = (s_message)message.m_object[0];
            List <int> input = (List <int>)mes.m_object[0];

            protocol.game.cmsg_upload_map msg = new protocol.game.cmsg_upload_map();
            msg.id    = game_data._instance.m_map_id;
            msg.ver   = game_data.m_self_map_ver;
            msg.time  = (int)mes.m_ints[1];
            msg.video = game_data._instance.save_inputs(input);
            net_http._instance.send_msg <protocol.game.cmsg_upload_map>(opclient_t.OPCODE_UPLOAD_MAP, msg);
        }
        if (message.m_type == "play_gui_uplw_cancel")
        {
            protocol.game.cmsg_upload_map msg = new protocol.game.cmsg_upload_map();
            msg.id  = game_data._instance.m_map_id;
            msg.ver = game_data.m_self_map_ver;
            net_http._instance.send_msg <protocol.game.cmsg_upload_map>(opclient_t.OPCODE_UPLOAD_MAP, msg);
        }
    }
Ejemplo n.º 15
0
 public void message(s_message message)
 {
     if (message.m_type == "play_mode")
     {
         m_edit_mode.SetActive(false);
         m_play_mode.SetActive(true);
         m_rd.SetActive(true);
         m_rd1.SetActive(true);
         m_fuzhu.SetActive(false);
         mario_point p     = (mario_point)message.m_object[0];
         int         world = 0;
         if (message.m_ints.Count > 0)
         {
             world = (int)message.m_ints[0];
         }
         int mode = 0;
         if (message.m_ints.Count > 1)
         {
             mode = (int)message.m_ints[1];
         }
         m_play_mode.GetComponent <play_mode>().reload(p, world, mode);
     }
     if (message.m_type == "close_play_mode")
     {
         m_play_mode.SetActive(false);
         if (mario._instance.m_game_state != e_game_state.egs_edit)
         {
             m_rd.SetActive(false);
             m_rd1.SetActive(false);
         }
     }
     if (message.m_type == "edit_mode")
     {
         m_play_mode.SetActive(false);
         m_edit_mode.SetActive(true);
         m_rd.SetActive(true);
         m_rd1.SetActive(true);
         m_fuzhu.SetActive(true);
         mario_point p = null;
         if (message.m_object.Count > 0)
         {
             p = (mario_point)message.m_object[0];
         }
         int world = 0;
         if (message.m_ints.Count > 0)
         {
             world = (int)message.m_ints[0];
         }
         m_edit_mode.GetComponent <edit_mode>().reload(p, world, m_edit_cys);
         m_edit_cys = new List <edit_cy>();
     }
     if (message.m_type == "close_edit_mode")
     {
         m_edit_mode.SetActive(false);
         m_rd.SetActive(false);
         m_rd1.SetActive(false);
     }
     if (message.m_type == "first_load")
     {
         foreach (KeyValuePair <int, s_t_unit> kv in game_data._instance.m_t_unit)
         {
             s_t_unit t_unit = kv.Value;
             string   name   = t_unit.res;
             string   cname  = "unit/" + name + "/" + name;
             if (t_unit != null && t_unit.kfg == 1)
             {
                 cname = "unit/" + name + "/1/" + name;
             }
             GameObject res = (GameObject)Resources.Load(cname);
             GameObject obj = (GameObject)Instantiate(res);
             obj.transform.parent        = m_loading.transform;
             obj.transform.localPosition = new Vector3(0, 0, 0);
             obj.transform.localScale    = new Vector3(1, 1, 1);
         }
         s_message mes = new s_message();
         mes.m_type = "first_load_end";
         mes.time   = 0.3f;
         cmessage_center._instance.add_message(mes);
     }
     if (message.m_type == "first_load_end")
     {
         mario._instance.remove_child(m_loading);
     }
     if (message.m_type == "edit_canying")
     {
         edit_cy ec = (edit_cy)message.m_object[0];
         if (m_edit_cys.Count > 0)
         {
             edit_cy cy1 = m_edit_cys[m_edit_cys.Count - 1];
             float   d   = Mathf.Sqrt((cy1.p.x - ec.p.x) * (cy1.p.x - ec.p.x) + (cy1.p.y - ec.p.y) * (cy1.p.y - ec.p.y));
             if (d < 640)
             {
                 return;
             }
         }
         m_edit_cys.Add(ec);
         if (m_edit_cys.Count > 50)
         {
             m_edit_cys.RemoveAt(0);
         }
     }
 }
Ejemplo n.º 16
0
    void Update()
    {
        if (m_start)
        {
            return;
        }
        if (edit_mode._instance == null || edit_mode._instance.m_main_char == null)
        {
            return;
        }
        if (m_joy.IsHolding)
        {
            m_ts1.SetActive(false);
            return;
        }
#if !UNITY_IPHONE && !UNITY_ANDROID
        if (mario._instance.key_down(KeyCode.LeftArrow) || mario._instance.key_down(KeyCode.RightArrow) || mario._instance.key_down(KeyCode.Z))
        {
            m_sm_panel.SetActive(false);
        }
#endif
        if (mario._instance.get_mouse_button())
        {
            if (mario._instance.m_self.guide == 2)
            {
                mario._instance.show_tip(game_data._instance.get_language_string("edit_gui_djsw"));
                return;
            }
            if (mario._instance.m_self.guide == 4)
            {
                mario._instance.show_tip(game_data._instance.get_language_string("edit_gui_djbc"));
                return;
            }
            Vector2 v    = mario._instance.get_mouse_position();
            bool    flag = true;
            if (v.x <= 96 || v.x >= Screen.width * utils.g_height / Screen.height - 96 || v.y <= 48 || v.y >= 560)
            {
                flag = false;
            }
            RaycastHit m_rayhit;
            Ray        _ui_ray = mario._instance.m_ui_camera.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(_ui_ray, out m_rayhit, 20.0f))
            {
                m_flag = true;
            }
            if (m_flag)
            {
                flag = false;
            }
            float x   = v.x - Screen.width * utils.g_height / 10 / Screen.height / 2;
            float y   = v.y - 64;
            int   mxx = (int)(x / 0.8 * 10 + edit_mode._instance.m_roll.x);
            int   myy = (int)(y / 0.8 * 10 + edit_mode._instance.m_roll.y);
            int   xx  = mxx / utils.g_grid_size;
            int   yy  = myy / utils.g_grid_size;
            if (xx == 1 && yy == game_data._instance.m_map_data.maps[m_world].qd_y && m_tuo_type == 0)
            {
                m_tuo_type = 1;
                m_tuo_pos  = v;
            }
            else if (xx == game_data._instance.m_map_data.maps[m_world].x_num - 2 && yy == game_data._instance.m_map_data.maps[m_world].zd_y && m_tuo_type == 0)
            {
                m_tuo_type = 2;
                m_tuo_pos  = v;
            }
            else if (m_tuo_type == 0 && flag && !(m_change_point.x == xx && m_change_point.y == yy))
            {
                m_change_point = new mario_point(xx, yy);
                int index = m_index;
                if (m_index > 0)
                {
                    index = m_row * 8 + m_index;
                    s_t_unit t_unit = game_data._instance.get_t_unit_by_site(index - 1);
                    index = t_unit.id;
                }
                if (index != 0 && mario._instance.m_self.guide == 1)
                {
                    bool fflag = false;
                    int  dnum  = utils.jx_block.Length / 3;
                    for (int i = 0; i < dnum; ++i)
                    {
                        int dx  = utils.jx_block[i * 3];
                        int dy  = utils.jx_block[i * 3 + 1];
                        int did = utils.jx_block[i * 3 + 2];
                        if (dy == yy && dx == xx)
                        {
                            fflag = true;
                            if (index != did)
                            {
                                mario._instance.show_tip(game_data._instance.get_language_string("edit_gui_zlbd"));
                                return;
                            }
                        }
                    }
                    if (!fflag)
                    {
                        mario._instance.show_tip(game_data._instance.get_language_string("edit_gui_qaxy"));
                        return;
                    }
                }
                edit_mode._instance.add_obj(xx, yy, index);
                m_need_save = true;
            }

            if (m_tuo_type > 0)
            {
                int vx = 0;
                if (v.x - m_tuo_pos.x > 50)
                {
                    vx = 1;
                }
                else if (v.x - m_tuo_pos.x < -50)
                {
                    vx = -1;
                }
                int vy = 0;
                if (v.y - m_tuo_pos.y > 50)
                {
                    vy = 1;
                }
                else if (v.y - m_tuo_pos.y < -50)
                {
                    vy = -1;
                }
                if (vx != 0 || vy != 0)
                {
                    edit_mode._instance.add_qz(m_tuo_type, vx, vy);
                    m_need_save = true;
                }
            }
            else
            {
                edit_mode._instance.add_qz(0, 0, 0);
            }
            edit_mode._instance.set_mpos(mxx, myy);
        }
        else
        {
            m_change_point = new mario_point();
            m_tuo_type     = 0;
            edit_mode._instance.not_add_obj();
            edit_mode._instance.add_qz(0, 0, 0);
            m_flag = false;
        }
        m_end.transform.localPosition           = new Vector3(game_data._instance.m_map_data.maps[m_world].x_num * 2 - 200 + 32, 42, 0);
        m_tip.transform.localPosition           = new Vector3(edit_mode._instance.m_main_char.m_pos.x / utils.g_grid_size * 2 - 200, 42, 0);
        m_zuobiao.GetComponent <UILabel>().text = "x:" + (edit_mode._instance.m_main_char.m_pos.x / utils.g_grid_size).ToString() + " y:" + (edit_mode._instance.m_main_char.m_pos.y / utils.g_grid_size).ToString();
    }
Ejemplo n.º 17
0
    public override void reset()
    {
        if (m_param[0] % 2 == 0)
        {
            set_fx(mario_fx.mf_right);
        }
        else
        {
            set_fx(mario_fx.mf_left);
        }

        if (m_param[0] < 2)
        {
            m_fx1.SetActive(true);
            m_fx2.SetActive(false);
        }
        else
        {
            m_fx1.SetActive(false);
            m_fx2.SetActive(true);
        }

        for (int i = 0; i < 4; ++i)
        {
            int x1 = m_init_pos.x + utils.csg_points[i * 2, 0] / 2;
            int y1 = m_init_pos.y + utils.csg_points[i * 2, 1] / 2;
            int x2 = m_init_pos.x + utils.csg_points[i * 2 + 1, 0] / 2;
            int y2 = m_init_pos.y + utils.csg_points[i * 2 + 1, 1] / 2;
            if (x1 < 0 || x1 >= game_data._instance.m_map_data.maps[m_world].x_num || y1 < 0 || y1 >= game_data._instance.m_map_data.maps[m_world].y_num)
            {
                continue;
            }
            if (x2 < 0 || x2 >= game_data._instance.m_map_data.maps[m_world].x_num || y2 < 0 || y2 >= game_data._instance.m_map_data.maps[m_world].y_num)
            {
                continue;
            }
            if (game_data._instance.m_arrays[m_world][y1][x1].type != utils.g_csg)
            {
                continue;
            }
            if (game_data._instance.m_arrays[m_world][y2][x2].type != utils.g_csg)
            {
                continue;
            }
            if (game_data._instance.m_arrays[m_world][y1][x1].param[2] == x2 && game_data._instance.m_arrays[m_world][y1][x1].param[3] == y2)
            {
                if (m_param[0] % 2 == 0)
                {
                    m_next = new mario_point(x2, y2);
                }
                else
                {
                    m_next = new mario_point(x1, y1);
                }
                break;
            }
            if (game_data._instance.m_arrays[m_world][y2][x2].param[2] == x1 && game_data._instance.m_arrays[m_world][y2][x2].param[3] == y1)
            {
                if (m_param[0] % 2 == 1)
                {
                    m_next = new mario_point(x2, y2);
                }
                else
                {
                    m_next = new mario_point(x1, y1);
                }
                break;
            }
        }
    }
Ejemplo n.º 18
0
    public override mario_point move()
    {
        mario_point p = new mario_point();

        if (m_hit)
        {
            m_hit_time++;
            if (m_hit_time < 5)
            {
                return(p);
            }
            int px = utils.g_grid_size * m_next.x + utils.g_grid_size / 2;
            int py = utils.g_grid_size * m_next.y + utils.g_grid_size / 2;
            if (px > m_pos.x)
            {
                m_pos.x += 40 * (m_param[0] / 2 + 1);
                p.x     += 40 * (m_param[0] / 2 + 1);
            }
            else if (px < m_pos.x)
            {
                m_pos.x -= 40 * (m_param[0] / 2 + 1);
                p.x     -= 40 * (m_param[0] / 2 + 1);
            }
            if (py > m_pos.y)
            {
                m_pos.y += 40 * (m_param[0] / 2 + 1);
                p.y     += 40 * (m_param[0] / 2 + 1);
            }
            else if (py < m_pos.y)
            {
                m_pos.y -= 40 * (m_param[0] / 2 + 1);
                p.y     -= 40 * (m_param[0] / 2 + 1);
            }
            if (px == m_pos.x && py == m_pos.y)
            {
                if (m_fx == mario_fx.mf_left)
                {
                    int nx = game_data._instance.m_arrays[m_world][m_next.y][m_next.x].param[0];
                    int ny = game_data._instance.m_arrays[m_world][m_next.y][m_next.x].param[1];
                    if (nx == 0 && ny == 0)
                    {
                        m_fx = mario_fx.mf_right;
                        nx   = game_data._instance.m_arrays[m_world][m_next.y][m_next.x].param[2];
                        ny   = game_data._instance.m_arrays[m_world][m_next.y][m_next.x].param[3];
                    }
                    m_next = new mario_point(nx, ny);
                }
                else
                {
                    int nx = game_data._instance.m_arrays[m_world][m_next.y][m_next.x].param[2];
                    int ny = game_data._instance.m_arrays[m_world][m_next.y][m_next.x].param[3];
                    if (nx == 0 && ny == 0)
                    {
                        m_fx = mario_fx.mf_left;
                        nx   = game_data._instance.m_arrays[m_world][m_next.y][m_next.x].param[0];
                        ny   = game_data._instance.m_arrays[m_world][m_next.y][m_next.x].param[1];
                    }
                    m_next = new mario_point(nx, ny);
                }
            }
        }
        return(p);
    }
Ejemplo n.º 19
0
    public void check_state(mario_point grid)
    {
        m_is_new = false;
        int x = m_grid.x - grid.x;
        int y = m_grid.y - grid.y;

        if (!Application.isEditor && !m_main)
        {
            if (x >= -utils.g_active_x && x <= utils.g_active_x && y >= -utils.g_active_y && y <= utils.g_active_y)
            {
                if (!this.gameObject.activeSelf)
                {
                    this.gameObject.SetActive(true);
                    if (m_shadow != null)
                    {
                        m_shadow.gameObject.SetActive(true);
                    }
                }
            }
            else
            {
                if (this.gameObject.activeSelf)
                {
                    this.gameObject.SetActive(false);
                    if (m_shadow != null)
                    {
                        m_shadow.gameObject.SetActive(false);
                    }
                }
            }
        }
        check_is_start(grid);
        if (m_unit != null && m_unit.id == utils.g_ryqiu)
        {
            if (x < -utils.g_del_x || x > utils.g_del_x)
            {
                m_is_destory = 2;
            }
        }
        else if (!m_main)
        {
            if (x >= -utils.g_start_x && x <= utils.g_start_x && y >= -utils.g_start_y && y <= utils.g_start_y)
            {
            }
            else if (!play_mode._instance.need_calc(m_grid.x, m_grid.y))
            {
                m_is_destory = 2;
            }
        }
        if (m_main)
        {
            if (m_pos.y < -100)
            {
                m_is_die = true;
            }
        }
        else if (m_unit != null && m_unit.id == utils.g_ryqiu)
        {
        }
        else if (m_pos.y < -utils.g_grid_size)
        {
            m_is_destory = 1;
        }
    }