Esempio n. 1
0
 public void create_spell(int spell_code, charactor speller, Vector2 direction, int wait_time, int move_mode)
 {
     if (spell_map.ContainsKey(get_code(spell_code)))
     {
         spell_list.Add(new spell(spell_code, speller, direction, wait_time, move_mode));
     }
 }
Esempio n. 2
0
 public void create_spell(int spell_code, charactor speller)
 {
     if (spell_map.ContainsKey(get_code(spell_code)))
     {
         spell_list.Add(new spell(spell_code, speller, new Vector2(0, 0), 0, 0));
     }
 }
Esempio n. 3
0
 public void set_speller(charactor speller_set)
 {
     speller = speller_set;
     bc      = speller.get_bc();
     ec      = speller.get_ec();
     sc      = speller.get_sc();
 }
Esempio n. 4
0
 public spell(int spell_code_set, charactor speller_set, Vector2 direction2_set, int wait_time_set, int move_mode_set)
 {
     spell_code = spell_code_set;
     speller    = speller_set;
     direction2 = direction2_set;
     move_mode  = move_mode_set;
     wait_time  = wait_time_set;
 }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     parent = transform.parent.gameObject.GetComponent <player> ();
     if (parent == null)
     {
         parent = transform.parent.gameObject.GetComponent <enemy> ();
     }
 }
Esempio n. 6
0
 public effect(int effect_code_set, bool direction_set, int wait_time_set, GameObject target_set, Vector2 position_set, charactor charactor_set)
 {
     effect_code = effect_code_set;
     direction   = direction_set;
     wait_time   = wait_time_set;
     position    = position_set;
     target      = target_set;
     charactor   = charactor_set;
     effect_mode = 3;
 }
Esempio n. 7
0
 private bool charactor_exist(charactor charactor_find)
 {
     foreach (charactor charactor in charactors)
     {
         if (charactor_find == charactor)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 8
0
 public void init(int buff_code_set, charactor buff_from_set, charactor buff_to_set, int time_full_set, int wait_time_set, buff_controller buff_controller_set)
 {
     buff_code       = buff_code_set;
     buff_from       = buff_from_set;
     buff_to         = buff_to_set;
     time_now        = time_full = time_full_set;
     dispersable     = false;
     wait_time       = wait_time_set;
     buff_controller = buff_controller_set;
     init2();
 }
Esempio n. 9
0
    void Start()
    {
        parent = transform.parent.gameObject;

        bearer = parent.GetComponent <charactor> ();
        player = GameObject.Find("hero").GetComponent <player> ();

        rb = parent.GetComponent <Rigidbody2D> ();
        ec = GameObject.Find("effect_controller").GetComponent <effect_controller> ();
        ac = GameObject.Find("audio_controller").GetComponent <audio_controller> ();
        bc = GameObject.Find("buff_controller").GetComponent <buff_controller> ();
    }
Esempio n. 10
0
    void Start()
    {
        parent = transform.parent.gameObject;

        bearer = parent.GetComponent <enemy> ();
        if (bearer == null)
        {
            bearer = parent.GetComponent <player> ();
        }
        rb = parent.GetComponent <Rigidbody2D> ();
        ec = GameObject.Find("effect_controller").GetComponent <effect_controller> ();
        ac = GameObject.Find("audio_controller").GetComponent <audio_controller> ();
        bc = GameObject.Find("buff_controller").GetComponent <buff_controller> ();
    }
Esempio n. 11
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        bear bear = collider.gameObject.GetComponent <bear> ();

        if (bear != null)
        {
            charactor bearer = bear.get_parent();
            if (speller == bearer)
            {
                return;
            }
        }
        Destroy(transform.gameObject);
    }
Esempio n. 12
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        bear bear = collider.gameObject.GetComponent <bear> ();

        if (bear != null)
        {
            charactor bearer = bear.get_parent();
            if (speller != bearer)
            {
                animator.SetBool(animator.parameters[0].nameHash, true);
                is_dead = true;
            }
        }
    }
Esempio n. 13
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (!is_dead)
     {
         bear bear = collider.gameObject.GetComponent <bear> ();
         if (bear != null)
         {
             charactor bearer = bear.get_parent();
             if (speller == bearer)
             {
                 return;
             }
         }
         life_time = 0;
     }
 }
Esempio n. 14
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        if (!inited)
        {
            return;
        }
        bear bear = collider.gameObject.GetComponent <bear> ();

        if (bear != null && speller != bear.get_parent())
        {
            attacked         = true;
            bearer           = bear.get_parent();
            direction        = bearer.get_direction();
            transform.parent = bearer.transform;
            bc.create_buff(1, speller, bearer, time_full, 0);
            speller.set_scroll_hit();
        }
    }
Esempio n. 15
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (!is_dead)
     {
         bear bear = collider.gameObject.GetComponent <bear> ();
         if (bear != null)
         {
             charactor bearer = bear.get_parent();
             if (speller == bearer)
             {
                 return;
             }
             else
             {
                 dead_time = 0;
             }
         }
         Destroy(GetComponent <Collider2D> ());
         Destroy(GetComponent <Rigidbody2D> ());
         is_dead          = true;
         transform.parent = collider.gameObject.transform;
     }
 }
Esempio n. 16
0
 public void create_buff(int buff_code, charactor buff_from, charactor buff_to, int time_full, int wait_time)
 {
     if (time_full > 0)
     {
         if (!charactor_exist(buff_to))
         {
             charactors.Add(buff_to);
         }
         buff old_buff = null;
         if (buff_to.get_buff_map().ContainsKey(buff_code))
         {
             old_buff = buff_to.get_buff_map() [buff_code];
         }
         if (old_buff == null)
         {
             buff new_buff = buff.new_buff(buff_code);
             new_buff.init(buff_code, buff_from, buff_to, time_full, wait_time, this);
             buff_to.get_buff_map() [buff_code] = new_buff;
         }
         else
         {
             if (time_full > old_buff.time_now)
             {
                 old_buff.time_full = time_full;
                 if (old_buff.time_now == 0)
                 {
                     old_buff.time_now = old_buff.time_full + 1;
                 }
                 else if (old_buff.time_now > 0)
                 {
                     old_buff.time_now = old_buff.time_full - 1;
                 }
             }
         }
     }
 }
Esempio n. 17
0
 public void set_attacker(charactor attacker_set)
 {
     attacker = attacker_set;
 }
Esempio n. 18
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        attack    attack   = collider.gameObject.GetComponent <attack> ();
        charactor attacker = attack.get_attacker();

        if (attacker == bearer)
        {
            return;
        }
        if (!attack.is_valid())
        {
            return;
        }
        if (!bearer.get_is_attackable())
        {
            return;
        }
        //flag only one hit attack
        attack.attacked();


        float position_x = bearer.transform.position.x - attacker.transform.position.x;

        bearer.set_direction(position_x < 0);

        Vector2 derection = transform.position - attacker.transform.position;

        rb.velocity = new Vector2((attack.beatback_damage * (derection.x > 0 ? 1 : -1)), rb.velocity.y);
        //floating
        if (attack.is_ground_floating || bearer.get_in_air())
        {
            rb.velocity = new Vector2(rb.velocity.x, attack.floating_damage);
        }

        attacker.add_speed(attack.self_beatback_damage * (position_x < 0 ? 1 : -1), attack.self_floating_damage);

        bearer.set_hp(bearer.hp_now - attack.damage);
        bc.create_buff(1, attacker, bearer, attack.stun, attack.frame_extract);

        //face to attacker
        bearer.set_last_attacked(attacker);
        attacker.set_last_attack(bearer);

        attacker.hit_message(attack);
        bearer.hitted_message(attack);
        //frame_extract
        bc.create_buff(3, bearer, bearer, Mathf.Max(attack.frame_extract, 1), 0);
        if (attack.is_melee)
        {
            bc.create_buff(3, attacker, attacker, attack.frame_extract, 0);
        }

        //effect
        ec.create_effect(1, false, parent, new Vector2(0, 0), bearer, attack.frame_extract);
        if (attack.damage > 8)
        {
            ec.create_effect(2, (Random.value > 0.5f), parent, new Vector2(0, 0), bearer, 0);
        }
        else
        {
            ec.create_effect(14, (Random.value > 0.5f), parent, new Vector2(0, 0), bearer, 0);
        }

        //ec.create_effect (5, bearer.get_direction(), parent, new Vector2(0,0), bearer, 0);


        if (attack.attack_kind == 0)
        {
            ec.create_effect(10, !bearer.get_direction(), parent, new Vector2((bearer.get_direction() ? -1 : 1) * (Random.value * 0.1f - 0.05f + 0.1f), Random.value * 0.1f - 0.12f), bearer, 0, attack.attack_direction);
        }
        if (attacker.is_player)
        {
            if (attack.frame_extract > 5)
            {
                if (Mathf.Abs(attack.attack_direction.x) >= Mathf.Abs(attack.attack_direction.y))
                {
                    player.set_camera_shaking_code(attack.frame_extract * 10 + 1);
                }
                else
                {
                    if (attack.attack_direction.y > 0)
                    {
                        player.set_camera_shaking_code(attack.frame_extract * 10 + 2);
                    }
                    else
                    {
                        player.set_camera_shaking_code(attack.frame_extract * 10 + 3);
                    }
                }
            }
        }

        //stun
        bc.create_buff(100, bearer, bearer, 10, 0);

        //audio
        ac.create_audio((Random.value > 0.5f ? 1 : 2), attack.frame_extract);
    }
Esempio n. 19
0
 public void set_last_attacked(charactor last_attacked_now)
 {
     last_attacked = last_attacked_now;
 }
Esempio n. 20
0
 public void create_effect(int effect_code, bool direction, GameObject target_set, Vector2 position, charactor charactor_set, int wait_time, Vector2 direction2_set)
 {
     effect_list.Add(new effect(effect_code, direction, wait_time, target_set, position, charactor_set, direction2_set));
 }
Esempio n. 21
0
 // Use this for initialization
 void Start()
 {
     parent = transform.parent.gameObject.GetComponent <charactor> ();
 }
Esempio n. 22
0
 public void set_last_attack(charactor last_attack_now)
 {
     last_attack = last_attack_now;
 }
Esempio n. 23
0
 public void set_jump_target(charactor jump_target_set)
 {
     jump_target = jump_target_set;
 }
Esempio n. 24
0
 public void set_speller(charactor speller_set)
 {
     speller = speller_set;
 }