コード例 #1
0
    public void efe_text_on(int k, float x, float y, int i_size, string s, Color i_color)
    {
        efe_n++; if (efe_n >= 100)
        {
            efe_n = 0;
        }
        int i = efe_n;

        if (efe_d[i].c == 0)
        {
            efe_d[i]      = new tefe(k, x, y);
            efe_d[i].fish = (GameObject)Instantiate(efe_text_prefab, new Vector2(x, y), Quaternion.identity);
            efe_d[i].fish.GetComponent <Text>().text = s;

            efe_d[i].fish.name = "efe_text," + i;
            efe_d[i].fish.GetComponent <Text>().fontSize = i_size;
            efe_d[i].color    = i_color;
            efe_d[i].x        = x;
            efe_d[i].y        = y;
            efe_d[i].zx       = 1;
            efe_d[i].zy       = 1;
            efe_d[i].text_efe = 1;
            efe_d[i].fish.transform.SetParent(canvas_obj.transform);
            efe_d[i].fish.transform.localScale = new Vector2(0.1f, 0.1f);


            if (efe_d[i].kind == 0)
            {
                efe_d[i].xn   = x;
                efe_d[i].yn   = y + my.max_world_y / 20;
                efe_d[i].slow = 100;
            }
        }
    }
コード例 #2
0
    public void efe_on0(int k, float x, float y, Vector2 v_scale, float half_between_x, float half_between_y)
    {
        efe_n++; if (efe_n >= 100)
        {
            efe_n = 0;
        }
        int i = efe_n;

        if (efe_d[i].c == 0)
        {
            efe_d[i]      = new tefe(k, x, y);
            efe_d[i].fish = (GameObject)Instantiate(efe_prefab, new Vector2(x, y), Quaternion.identity);

            efe_d[i].fish.name = "efe," + i;
            efe_d[i].fish.transform.localScale = v_scale;
            if (efe_d[i].fish.GetComponent <SpriteRenderer>())
            {
                efe_d[i].color = efe_d[i].fish.GetComponent <SpriteRenderer>().color;
            }
            efe_d[i].x = x + UnityEngine.Random.Range(0, half_between_x) - UnityEngine.Random.Range(0, half_between_x);
            efe_d[i].y = y + UnityEngine.Random.Range(0, half_between_y) - UnityEngine.Random.Range(0, half_between_y);
            //efe_d[i].xw = efe_d[i].fish.GetComponent<SpriteRenderer>().bounds.size.x;
            //efe_d[i].yw = efe_d[i].fish.GetComponent<SpriteRenderer>().bounds.size.y;
            efe_d[i].zx       = v_scale.x;
            efe_d[i].zy       = v_scale.y;
            efe_d[i].text_efe = 0;

            if (efe_d[i].kind == 0)
            {
                efe_d[i].xn = efe_d[i].x - UnityEngine.Random.Range(0.0f, half_between_x) + UnityEngine.Random.Range(0.0f, half_between_y);
                efe_d[i].yn = -0.18f + UnityEngine.Random.Range(0.0f, 0.03f);
            }
            if (efe_d[i].kind == 1)
            {
                efe_d[i].x     = x;
                efe_d[i].y     = y;
                efe_d[i].slow  = 10;
                efe_d[i].color = new Color(1, 0, 0, 1);
                float i_kaku = UnityEngine.Random.Range(0f, 360f);
                float l      = UnityEngine.Random.Range(0f, efe_d[i].zx);

                efe_d[i].xn = x + Mathf.Cos(i_kaku * (Mathf.PI / 180)) * l;
                efe_d[i].yn = y + Mathf.Sin(i_kaku * (Mathf.PI / 180)) * l;
            }
            if (efe_d[i].kind == 2)
            {
                efe_d[i].xn    = x;
                efe_d[i].yn    = y - efe_d[i].zy / 2;
                efe_d[i].slow  = 100;
                efe_d[i].color = new Color(0.5f, 0.5f, 1, 1);
            }
            if (efe_d[i].kind == 3)
            {
                efe_d[i].xn   = x;
                efe_d[i].yn   = y + efe_d[i].zy / 2;
                efe_d[i].slow = 100;
            }
        }
    }