Beispiel #1
0
 public override bool be_top_hit(mario_obj obj, ref int py)
 {
     if (obj.m_type != mario_type.mt_charater)
     {
         return(false);
     }
     if (obj.m_main && !m_hit)
     {
         m_hit = true;
         dingchu();
         for (int i = 0; i < m_nl_objs.Count; ++i)
         {
             mario_obj obj1 = m_nl_objs[i];
             if (obj1.m_life == 1 || obj1.m_wgk)
             {
                 obj1.set_bl(0, 4);
             }
             else
             {
                 obj1.m_pvelocity.y = 200;
             }
         }
     }
     return(base.be_top_hit(obj, ref py));
 }
Beispiel #2
0
 public override bool be_top_hit(mario_obj obj, ref int px)
 {
     if (obj.m_type != mario_type.mt_charater)
     {
         return(false);
     }
     if (obj.m_main)
     {
         if (!m_hit)
         {
             for (int i = 0; i < m_nl_objs.Count; ++i)
             {
                 mario_obj obj1 = m_nl_objs[i];
                 if (obj1.m_life == 1 || obj1.m_wgk)
                 {
                     obj1.set_bl(0, 4);
                 }
                 else
                 {
                     obj1.m_pvelocity.y = 250;
                 }
             }
         }
         if (m_param[0] > 0)
         {
             hit1();
         }
         else
         {
             hit();
         }
     }
     return(base.be_top_hit(obj, ref px));
 }
Beispiel #3
0
 public override void reset()
 {
     if (m_hg_ex == null)
     {
         List <int> p = new List <int>();
         p.Add(m_param[0]);
         p.Add(m_param[1]);
         p.Add(m_param[2]);
         p.Add(m_param[3]);
         if (m_edit_mode)
         {
             m_hg_ex = edit_mode._instance.create_mario_obj("mario_huogun_ex", null, p, m_init_pos.x, m_init_pos.y);
         }
         else
         {
             m_hg_ex = play_mode._instance.create_mario_obj("mario_huogun_ex", null, p, m_init_pos.x, m_init_pos.y);
         }
     }
     if (m_param [0] % 2 == 0)
     {
         set_fx(mario_fx.mf_left);
     }
     else
     {
         set_fx(mario_fx.mf_right);
     }
 }
Beispiel #4
0
 public override bool be_bottom_hit(mario_obj obj, ref int py)
 {
     if (m_bl[0] == 1)
     {
         return(false);
     }
     if (obj.m_main)
     {
         obj.m_pvelocity.y = 150;
         if (obj.m_velocity.y < 0)
         {
             obj.m_velocity.y = 0;
         }
         play_mode._instance.caisi(0, true, obj.m_pos.x, obj.m_bound.bottom);
         this.m_is_destory = 1;
         play_mode._instance.add_score(m_pos.x, m_pos.y, 200);
         mario._instance.play_sound("sound/caisi");
         List <int> l = new List <int>();
         l.Add(1);
         l.Add(0);
         l.Add(0);
         l.Add(0);
         play_mode._instance.create_mario_obj_ex("mario_wuguike", null, l, -1, -1, m_pos.x, m_pos.y);
         py = obj.get_bottom_hit_pos(this);
         return(true);
     }
     return(base.be_bottom_hit(obj, ref py));
 }
Beispiel #5
0
 public override bool be_right_bottom_hit(mario_obj obj, ref int px, ref int py)
 {
     if (obj.m_type != mario_type.mt_charater)
     {
         return(false);
     }
     if (obj.m_main)
     {
         play_mode._instance.caisi(80);
         obj.m_pvelocity.y = 240;
     }
     else
     {
         obj.m_pvelocity.y = 300;
     }
     if (obj.m_velocity.y < 0)
     {
         obj.m_velocity.y = 0;
     }
     px = obj.m_pos.x;
     py = obj.get_bottom_hit_pos(this);
     play_anim("hit");
     play_yinfu();
     return(true);
 }
Beispiel #6
0
 void dingchu()
 {
     if (m_param[0] == 0)
     {
     }
     else
     {
         while (m_objs.Count < 3)
         {
             m_objs.Add(null);
         }
         int index = -1;
         for (int i = 0; i < m_objs.Count; ++i)
         {
             if (m_objs[i] == null)
             {
                 index = i;
                 break;
             }
         }
         if (index == -1)
         {
             return;
         }
         s_t_unit   t_unit = game_data._instance.get_t_unit(m_param[0]);
         List <int> p      = new List <int>();
         p.Add(m_param[1]);
         p.Add(m_param[2]);
         p.Add(m_param[3]);
         p.Add(0);
         mario_obj obj1 = play_mode._instance.create_mario_obj(t_unit.res, null, p, m_init_pos.x, m_init_pos.y);
         m_objs[index] = obj1.gameObject;
     }
 }
Beispiel #7
0
 public override void be_hit(mario_obj obj)
 {
     if (obj.m_main)
     {
         obj.set_bl(0, 4);
     }
 }
Beispiel #8
0
 public override void reset()
 {
     mario._instance.remove_child(m_s);
     if (m_shadow != null)
     {
         mario._instance.remove_child(m_shadow.GetComponent <mario_wenhao>().m_s);
     }
     m_edit_obj = null;
     if (m_param[0] != 0 && m_edit_mode)
     {
         s_t_unit   t_unit = game_data._instance.get_t_unit(m_param[0]);
         string     cname  = "unit/" + t_unit.res + "/" + t_unit.res;
         GameObject res    = (GameObject)Resources.Load(cname);
         m_edit_obj = (GameObject)Instantiate(res);
         m_edit_obj.transform.parent     = m_s.transform;
         m_edit_obj.transform.localScale = new Vector3(1, 1, 1);
         mario_obj mobj = m_edit_obj.GetComponent <mario_obj> ();
         mobj.m_edit_mode = true;
         List <int> p = new List <int>();
         p.Add(m_param[1]);
         p.Add(m_param[2]);
         p.Add(m_param[3]);
         p.Add(0);
         mobj.init(t_unit.res, p, m_world, -1, -1, 0, 0);
     }
 }
Beispiel #9
0
    void dingchu()
    {
        m_hit       = true;
        m_is_static = true;
        m_has_floor = true;
        m_is_dzd    = 2;
        m_fxdiv     = 2;
        m_bkcf      = true;

        if (m_param[0] == 0)
        {
            play_anim("hit1");
            mario._instance.play_sound("sound/coins");
        }
        else
        {
            s_t_unit t_unit = game_data._instance.get_t_unit(m_param[0]);
            play_anim("hit");
            mario._instance.play_sound("sound/dinfo");
            List <int> p = new List <int>();
            p.Add(m_param[1]);
            p.Add(m_param[2]);
            p.Add(m_param[3]);
            p.Add(0);
            mario_obj obj1 = play_mode._instance.create_mario_obj(t_unit.res, null, p, m_init_pos.x, m_init_pos.y);
            obj1.set_bl(0, 1);
        }
        this.transform.FindChild("sprite").GetComponent <SpriteRenderer>().sortingOrder = 1;
    }
Beispiel #10
0
    public void create_shadow(GameObject back)
    {
        if (m_shadow != null)
        {
            Object.Destroy(m_shadow);
        }
        GameObject obj = (GameObject)Instantiate(this.gameObject);

        obj.transform.parent           = back.transform;
        obj.transform.localPosition    = this.transform.localPosition;
        obj.transform.localScale       = this.transform.localScale;
        obj.transform.localEulerAngles = this.transform.localEulerAngles;
        m_shadow     = obj;
        m_shadow_obj = m_shadow.GetComponent <mario_obj> ();
        if (m_shadow_obj.m_mario_anim != null)
        {
            if (m_shadow_obj.m_mario_anim.do_defualt())
            {
                if (m_shadow_obj.m_animator != null)
                {
                    m_shadow_obj.m_animator.enabled = false;
                }
            }
            else
            {
                m_shadow_obj.m_mario_anim.enabled = false;
            }
        }

        format_shadow(m_shadow.transform, "shader/shadow", -10);
    }
Beispiel #11
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);
         }
     }
 }
Beispiel #12
0
    public void insert(mario_obj obj)
    {
        if (nodes[0] != null)
        {
            int index = get_index(obj.m_bound);
            if (index != -1)
            {
                nodes[index].insert(obj);
                return;
            }
        }

        List <mario_obj> sub_objs = objects [(int)obj.m_type];

        sub_objs.Add(obj);
        obj.m_qtree = this;

        if (nodes[0] == null && sub_objs.Count > max_object && level < max_level)
        {
            split();
            for (int i = sub_objs.Count - 1; i >= 0; i--)
            {
                mario_obj tobj  = sub_objs[i];
                int       index = get_index(tobj.m_bound);
                if (index != -1)
                {
                    sub_objs.RemoveAt(i);
                    nodes[index].insert(tobj);
                }
            }
        }
    }
Beispiel #13
0
    public override bool be_right_hit(mario_obj obj, ref int px)
    {
        if (obj.m_type != mario_type.mt_charater || m_main)
        {
            return(false);
        }
        if (obj.m_main)
        {
            if (m_is_guaiwu)
            {
                obj.set_bl(0, 4);
            }
            return(false);
        }
        if (obj.m_velocity.x > 0)
        {
            obj.m_velocity.x = 0;
            obj.change_way(mario_fx.mf_left);
        }
        if (m_velocity.x < 0)
        {
            m_velocity.x = 0;
            change_way(mario_fx.mf_right);
        }

        px = obj.m_pos.x;
        return(true);
    }
Beispiel #14
0
 public override void be_hit(mario_obj obj)
 {
     base.be_hit(obj);
     if (obj.m_name == "mario_huoqiu_big" || (obj.m_name == "mario_luoci" && obj.m_param[0] != 0))
     {
         hit();
     }
 }
Beispiel #15
0
 public int get_right_hit_pos(mario_obj obj)
 {
     if (m_collider == null || obj.m_collider == null)
     {
         return(0);
     }
     return(obj.m_pos.x + obj.m_collider.m_rect.x - obj.m_collider.m_rect.w / 2 - m_collider.m_rect.w / 2 - m_collider.m_rect.x);
 }
Beispiel #16
0
 public bool hit(mario_obj obj)
 {
     if (m_collider == null || obj.m_collider == null)
     {
         return(false);
     }
     return(m_bound.right >= obj.m_bound.left && m_bound.left <= obj.m_bound.right && m_bound.top >= obj.m_bound.bottom && m_bound.bottom <= obj.m_bound.top);
 }
Beispiel #17
0
 public override bool be_right_bottom_hit(mario_obj obj, ref int px, ref int py)
 {
     if (m_param[0] == 2 && obj.m_main)
     {
         m_state = 1;
     }
     return(base.be_right_bottom_hit(obj, ref px, ref py));
 }
Beispiel #18
0
 public int get_bottom_hit_pos(mario_obj obj)
 {
     if (m_collider == null || obj.m_collider == null)
     {
         return(0);
     }
     return(obj.m_pos.y + obj.m_collider.m_rect.y + obj.m_collider.m_rect.h / 2 + m_collider.m_rect.h / 2 - m_collider.m_rect.y);
 }
Beispiel #19
0
 public override bool be_right_bottom_hit(mario_obj obj, ref int px, ref int py)
 {
     if (!m_hit)
     {
         return(false);
     }
     return(base.be_right_bottom_hit(obj, ref px, ref py));
 }
Beispiel #20
0
 public override bool be_top_hit(mario_obj obj, ref int py)
 {
     if (m_hit)
     {
         return(false);
     }
     return(base.be_top_hit(obj, ref py));
 }
Beispiel #21
0
 public override void be_hit(mario_obj obj)
 {
     if (m_bl[0] == 1)
     {
         return;
     }
     base.be_hit(obj);
 }
Beispiel #22
0
 public override void be_hit(mario_obj obj)
 {
     if (obj.m_main && obj.m_pos.x > m_bound.left && obj.m_pos.x < m_bound.right && obj.m_pos.y > m_bound.bottom && obj.m_pos.y < m_bound.top)
     {
         m_hit = true;
         play_mode._instance.show_chuan(this);
     }
 }
Beispiel #23
0
 public override bool be_top_hit(mario_obj obj, ref int py)
 {
     if (obj.m_main && !m_hit)
     {
         m_hit = true;
         dingchu();
     }
     return(base.be_top_hit(obj, ref py));
 }
Beispiel #24
0
 public override bool be_right_bottom_hit(mario_obj obj, ref int px, ref int py)
 {
     if (obj.m_type != mario_type.mt_charater)
     {
         return(false);
     }
     m_hit = true;
     return(base.be_right_bottom_hit(obj, ref px, ref py));
 }
Beispiel #25
0
 public override void be_hit(mario_obj obj)
 {
     if (obj.m_main && !m_hit && m_world == game_data._instance.m_map_data.end_area)
     {
         m_hit = true;
         obj.m_bl_objs.Add(this);
         play_mode._instance.m_state = 1;
         mario._instance.play_sound("sound/end");
     }
 }
Beispiel #26
0
 public override void be_hit(mario_obj obj)
 {
     if (obj.m_main)
     {
         int d = (int)Mathf.Sqrt((m_pos.x - obj.m_pos.x) * (m_pos.x - obj.m_pos.x) + (m_pos.y - obj.m_pos.y) * (m_pos.y - obj.m_pos.y));
         if (d < m_db)
         {
             obj.set_bl(0, 4);
         }
     }
 }
Beispiel #27
0
 public override void be_hit(mario_obj obj)
 {
     if (obj.m_main)
     {
         mario._instance.play_sound("sound/coins");
         this.m_is_die = true;
         m_bkcf        = true;
         this.play_anim("die");
         play_mode._instance.add_score(m_pos.x, m_pos.y, 100);
     }
 }
Beispiel #28
0
 public override void be_hit(mario_obj obj)
 {
     if (obj.m_main)
     {
         m_is_destory = 1;
         play_mode._instance.caisi(0, false);
         mario._instance.play_sound("sound/get");
         play_mode._instance.add_score(m_pos.x, m_pos.y, 1000);
         play_mode._instance.m_ys++;
     }
 }
Beispiel #29
0
    public void retrive(mario_obj obj, ref List <mario_obj> objs, int type)
    {
        retrive_ex(obj.m_bound, ref objs, type);
        mario_qtree t = obj.m_qtree.parent;

        while (t != null)
        {
            objs.AddRange(t.objects[type]);
            t = t.parent;
        }
    }
Beispiel #30
0
 public override void be_hit(mario_obj obj)
 {
     base.be_hit(obj);
     if (obj.m_name == "mario_huoqiu_big" || (obj.m_name == "mario_luoci" && obj.m_param[0] != 0))
     {
         m_is_die = true;
         m_bkcf   = true;
         this.play_anim("die");
         play_mode._instance.add_score(10);
         mario._instance.play_sound("sound/ding");
     }
 }