コード例 #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;
    }
コード例 #2
0
    public void Update()
    {
        float alpha = 0.0f;

        switch (black_bars_state)
        {
        case BLACK_BARS_STATE.BBS_NONE:
            break;

        case BLACK_BARS_STATE.BBS_APPEARING:
            black_bar_appearing_timer += Time.deltaTime;

            alpha = black_bar_appearing_timer / black_bar_appearing_time;

            black_bar_top_img.SetAlpha(alpha);
            black_bar_bot_img.SetAlpha(alpha);

            if (alpha >= 1.0f)
            {
                black_bar_appearing_timer = 0.0f;
                black_bars_state          = BLACK_BARS_STATE.BBS_NONE;
            }
            break;

        case BLACK_BARS_STATE.BBS_DISAPPEARING:
            black_bar_appearing_timer += Time.deltaTime;

            alpha  = (black_bar_appearing_timer / black_bar_appearing_time) - 1.0f;
            alpha *= -1.0f;

            black_bar_top_img.SetAlpha(alpha);
            black_bar_bot_img.SetAlpha(alpha);

            if (alpha <= 0.0f)
            {
                black_bars_state = BLACK_BARS_STATE.BBS_NONE;
            }

            break;

        default:
            break;
        }
    }
コード例 #3
0
    public void Start()
    {
        black_bar_top = GetLinkedObject("black_bar_top");
        black_bar_bot = GetLinkedObject("black_bar_bot");

        black_bar_top_img = black_bar_top.GetComponent <CompImage>();
        black_bar_bot_img = black_bar_bot.GetComponent <CompImage>();

        black_bar_top_img.SetAlpha(0.0f);
        black_bar_bot_img.SetAlpha(0.0f);

        black_bars_state = BLACK_BARS_STATE.BBS_NONE;
    }
コード例 #4
0
    public void Update()
    {
        if (!appeared)
        {
            hp_bar_appearing_timer += Time.deltaTime;
            hp_bar_img.SetAlpha(hp_bar_appearing_timer / hp_bar_appearing_time);
            hp_bar_img_background.SetAlpha(hp_bar_appearing_timer / hp_bar_appearing_time);

            float spd = (icons_end_y - icons_initial_y) / hp_bar_appearing_time;
            icons_position.y = icons_initial_y + spd * hp_bar_appearing_timer;
            player_icons_transform.SetUIPosition(icons_position);
            hp_bar_parent_position.y = hp_bar_initial_y + spd * hp_bar_appearing_timer;
            hp_bar_parent_transform.SetUIPosition(hp_bar_parent_position);

            if (hp_bar_appearing_timer >= hp_bar_appearing_time)
            {
                icons_position.y = icons_end_y;
                player_icons_transform.SetUIPosition(icons_position);
                hp_bar_img.SetAlpha(1.0f);
                hp_bar_img_background.SetAlpha(1.0f);
                appeared = true;
            }
        }
    }