Exemplo n.º 1
0
    void Start()
    {
        rb = GetComponent <Rigidbody2D>();

        sprite          = transform.Find("sprite").gameObject;
        animator        = sprite.GetComponent <Animator>();
        anime_para_list = new List <int>();
        foreach (AnimatorControllerParameter parameter in animator.parameters)
        {
            anime_para_list.Add(parameter.nameHash);
        }

        foreach (Transform child in transform.Find("skills"))
        {
            GameObject child_obj = child.gameObject;
            skills.Add(child_obj);
            child.gameObject.SetActive(false);
            attack attack = child_obj.GetComponent <attack>();
            if (attack != null)
            {
                attack.set_attacker(this);
            }
        }
        ec = GameObject.Find("effect_controller").GetComponent <effect_controller>();
        ac = GameObject.Find("audio_controller").GetComponent <audio_controller>();
        sc = GameObject.Find("spell_controller").GetComponent <spell_controller>();
        bc = GameObject.Find("buff_controller").GetComponent <buff_controller>();

        Start2();
    }
Exemplo n.º 2
0
    void OnEnable()
    {
        if (speller != null)
        {
            rb             = GetComponent <Rigidbody2D> ();
            animator       = GetComponent <Animator> ();
            light          = transform.Find("light").gameObject.GetComponent <Light>();
            explode_attack = transform.Find("attack").gameObject;
            explode_attack.SetActive(false);
            intensity = 4;

            direction = speller.get_direction();
            speed     = 4f;

            Vector2 parent_position = speller.get_position2();

            transform.position   = new Vector3(parent_position.x + (direction ? 1 : -1) * 0.1f, parent_position.y - 0.1f, transform.position.z);
            transform.localScale = new Vector2((direction ? -1 : 1), 1);

            attack attack = gameObject.GetComponent <attack> ();
            attack.set_attacker(speller);
            explode_attack.GetComponent <attack> ().set_attacker(speller);

            life_time = 300;
            speller.set_scroll_hit();
        }
    }
Exemplo n.º 3
0
 void OnEnable()
 {
     if (speller != null)
     {
         direction2 = direction2.normalized;
         rb         = GetComponent <Rigidbody2D> ();
         sr         = GetComponent <SpriteRenderer> ();
         speed      = 15f;
         Vector2 parent_position = speller.get_position2();
         transform.position = new Vector3(parent_position.x + (direction2.x > 0 ? 1 : -1) * 0.2f, parent_position.y - 0.1f + (-0.1f * Random.value), transform.position.z);
         attack attack = gameObject.GetComponent <attack> ();
         attack.set_attacker(speller);
         dead_time = 200;
     }
 }
Exemplo n.º 4
0
 void OnEnable()
 {
     if (speller != null)
     {
         Vector2 parent_position   = speller.get_position2();
         bool    speller_direction = speller.get_direction();
         transform.position   = new Vector3(parent_position.x + (speller_direction ? 1 : -1) * 0.35f, parent_position.y + (-0.1f - 0.05f * Random.value), -5);
         transform.localScale = new Vector2((speller_direction ? 1 : -1), 1);
         transform.parent     = speller.transform;
         attack attack = gameObject.GetComponent <attack> ();
         attack.set_attacker(speller);
         animator  = GetComponent <Animator> ();
         inited    = true;
         time_full = 300;
     }
 }
Exemplo n.º 5
0
    void OnEnable()
    {
        if (speller != null)
        {
            time_max = 50;
            time_now = 0;
            is_front = true;
            is_dead  = false;
            animator = GetComponent <Animator> ();
            attack attack = gameObject.GetComponent <attack> ();
            attack.set_attacker(speller);
            intensity = 4;
            light     = transform.Find("light").gameObject.GetComponent <Light>();

            Vector2 position_center = speller.get_position2();
            transform.position = new Vector3(position_center.x, position_center.y - 0.08f, (is_front ? -0.01f : 0.01f));
            gameObject.GetComponent <TrailRenderer> ().enabled = true;
            DontDestroyOnLoad(gameObject);
        }
    }
Exemplo n.º 6
0
    void OnEnable()
    {
        if (speller != null)
        {
            animator           = GetComponent <Animator> ();
            transform.position = new Vector3(direction2.x, direction2.y, transform.position.z);

            foreach (Transform child in transform.Find("skills"))
            {
                GameObject child_obj = child.gameObject;
                child.gameObject.SetActive(false);
                skills.Add(child_obj);
                attack attack = child_obj.GetComponent <attack>();
                if (attack != null)
                {
                    attack.set_attacker(speller);
                }
            }
        }
    }
Exemplo n.º 7
0
    void OnEnable()
    {
        if (speller != null)
        {
            rb             = GetComponent <Rigidbody2D> ();
            explode_attack = transform.Find("attack").gameObject;
            explode_attack.SetActive(false);

            direction = speller.get_direction();
            speed     = 3f;

            Vector2 parent_position = speller.get_position2();

            transform.position   = new Vector3(parent_position.x + (direction ? 1 : -1) * 0.4f, parent_position.y - 0.05f, transform.position.z);
            transform.localScale = new Vector2((direction ? 1 : -1), 1);

            attack attack = gameObject.GetComponent <attack> ();
            attack.set_attacker(speller);
            explode_attack.GetComponent <attack> ().set_attacker(speller);

            life_time = 200;
        }
    }