示例#1
0
    public void Start()
    {
        hp_bar_boss_background = GetLinkedObject("hp_bar_boss_background");
        hp_bar_boss_image      = GetLinkedObject("hp_bar_boss_image");
        hp_bar_boss_text       = GetLinkedObject("hp_bar_boss_text");

        player_icons           = GetLinkedObject("player_icons");
        player_icons_transform = player_icons.GetComponent <CompRectTransform>();
        icons_position         = player_icons_transform.GetUIPosition();

        hp_bar_parent           = GetLinkedObject("hp_bar_parent");
        hp_bar_parent_transform = hp_bar_parent.GetComponent <CompRectTransform>();
        hp_bar_parent_position  = hp_bar_parent_transform.GetUIPosition();

        hp_bar_img            = hp_bar_boss_background.GetComponent <CompImage>();
        hp_bar_img_background = GetComponent <CompImage>();

        hp_bar_img.SetAlpha(0.0f);
        hp_bar_img_background.SetAlpha(0.0f);
        hp_bar_appearing_timer = 0.0f;

        icons_position.y = icons_initial_y;
        player_icons_transform.SetUIPosition(icons_position);
        hp_bar_parent_position.y = hp_bar_initial_y;
        hp_bar_parent_transform.SetUIPosition(hp_bar_parent_position);

        appeared = false;
    }
    protected void LinkComponents(GameObject icon_obj, GameObject icon_hp_obj, GameObject icon_stamina_obj, GameObject icon_mana_obj,
                                  GameObject left_button_obj, GameObject right_button_obj, GameObject sec_button_obj, GameObject sec_button_idle_obj,
                                  GameObject left_counter_obj, GameObject right_counter_obj, GameObject sec_counter_obj,
                                  GameObject left_arm_obj, GameObject right_arm_obj,
                                  GameObject left_button_idle_obj, GameObject right_button_idle_obj)
    {
        //LEFT ARM
        left_arm = left_arm_obj.GetComponent <CompMesh>();

        //RIGHT ARM
        right_arm = right_arm_obj.GetComponent <CompMesh>();

        //LEFT BUTTON
        left_button     = left_button_obj.GetComponent <CompButton>();
        left_button_img = left_button_obj.GetComponent <CompImage>();
        if (left_counter_obj != null)
        {
            left_counter = left_counter_obj.GetComponent <CompText>();
        }
        left_button_idle_img = left_button_idle_obj.GetComponent <CompImage>();

        //RIGHT BUTTON
        right_button     = right_button_obj.GetComponent <CompButton>();
        right_button_img = right_button_obj.GetComponent <CompImage>();
        if (right_counter_obj != null)
        {
            right_counter = right_counter_obj.GetComponent <CompText>();
        }
        right_button_idle_img = right_button_idle_obj.GetComponent <CompImage>();

        //SECONDARY BUTTON
        sec_button     = sec_button_obj.GetComponent <CompButton>();
        sec_button_img = sec_button_obj.GetComponent <CompImage>();
        if (sec_counter_obj != null)
        {
            sec_counter = sec_counter_obj.GetComponent <CompText>();
        }
        sec_button_trans = sec_button_obj.GetComponent <CompRectTransform>();

        sec_button_idle_img   = sec_button_idle_obj.GetComponent <CompImage>();
        sec_button_idle_trans = sec_button_idle_obj.GetComponent <CompRectTransform>();

        //HUD ICON
        icon_trans  = icon_obj.GetComponent <CompRectTransform>();
        icon_img    = icon_obj.GetComponent <CompImage>();
        icon_hp_img = icon_hp_obj.GetComponent <CompImage>();
        if (icon_mana_obj != null)
        {
            icon_mana_img = icon_mana_obj.GetComponent <CompImage>();
        }
        if (icon_stamina_obj != null)
        {
            icon_stamina_img = icon_stamina_obj.GetComponent <CompImage>();
        }
    }
    public void Start()
    {
        black_bar_top = GetLinkedObject("black_bar_top");
        black_bar_bot = GetLinkedObject("black_bar_bot");

        black_bar_top_rect_transform = black_bar_top.GetComponent <CompRectTransform>();
        black_bar_bot_rect_transform = black_bar_bot.GetComponent <CompRectTransform>();

        black_bar_top.GetComponent <CompImage>().SetEnabled(false);
        black_bar_bot.GetComponent <CompImage>().SetEnabled(false);

        black_bars_state = BLACK_BARS_STATE.BBS_NONE;

        speed       = Mathf.Abs(top_bar_initial_pos_y - top_bar_final_pos_y) / black_bar_appearing_time;
        new_pos_vec = Vector3.Zero;
    }