Пример #1
0
    // Update is called once per frame
    public override void Update()
    {
        Rigidbody2D rb = GetComponent <Rigidbody2D> ();

        //rb.velocity *= 0.99;

        base.Update();

        _LifeSpan1 -= Time.deltaTime;

        float          时刻   = Time.realtimeSinceStartup;
        SpriteRenderer sr   = GetComponent <SpriteRenderer> ();
        Color          当前颜色 = sr.color;

        float 透明度 = 当前颜色.a;

        透明度 = Mathf.PerlinNoise(
            _噪声速率.x * 时刻, _噪声速率.y * 时刻);
        透明度 = AT_MathUtil.map(
            透明度,
            0.0f, 1.0f,
            _基准值 - _最大偏移,
            _基准值 + _最大偏移);
        当前颜色.a = 透明度;

        sr.color = 当前颜色;
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        SpriteRenderer sr    = GetComponent <SpriteRenderer> ();
        float          当前透明度 = sr.color.a;

        float   时刻  = Time.realtimeSinceStartup;
        Vector3 HSV = Vector3.zero;

        for (int i = 0; i < 3; i++)
        {
            float X     = _噪声变化速率 [i] * 时刻;
            float Y     = X * _噪声变化的斜率[i];
            float value = Mathf.PerlinNoise(X, Y + _噪声变化的Y起点 [i]);
            HSV [i] = AT_MathUtil.map(value, 0, 1.0f, _HSV范围.min [i], _HSV范围.max [i]);
        }
        HSV [0] = Mathf.Repeat(HSV [0], 1.0f);
        HSV [1] = Mathf.Clamp01(HSV [1]);
        HSV [2] = Mathf.Clamp01(HSV[2]);
        Color 当前颜色 =
            Color.HSVToRGB(HSV [0], HSV [1], HSV [2]);

        当前颜色.a = 当前透明度;

        sr.color = 当前颜色;
    }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        Rigidbody2D rb = GetComponent <Rigidbody2D>();

        if (rb == null)
        {
            return;
        }
        controlWind();
        acceleration = acceleration + acVary;
        rb.AddForce(acceleration);
        acceleration.Set(0, 0, 0);


        float          时刻   = Time.realtimeSinceStartup;
        SpriteRenderer sr   = GetComponent <SpriteRenderer>();
        Color          当前颜色 = sr.color;

        float 透明度 = 当前颜色.a;

        透明度 = Mathf.PerlinNoise(
            _噪声速率.x * 时刻, _噪声速率.y * 时刻);
        透明度 = AT_MathUtil.map(
            透明度,
            0.0f, 1.0f,
            _基准值 - _最大偏移,
            _基准值 + _最大偏移);
        当前颜色.a = 透明度;

        sr.color = 当前颜色;
    }
Пример #4
0
    // Update is called once per frame
    void Update()
    {
        float nowTime = Time.realtimeSinceStartup;

        float scale = Mathf.PerlinNoise(nowTime, noisePara);

        scale = AT_MathUtil.map(scale, 0.0f, 1.0f, minScale, maxScale);
        Vector3 v3 = preSize * scale;

        transform.localScale = v3;
    }
Пример #5
0
    // Update is called once per frame
    void Update()
    {
        float 当前时刻_秒 = Time.realtimeSinceStartup;
        float 随机尺度   =
            Mathf.PerlinNoise(当前时刻_秒, _噪声参数y);

        随机尺度 = AT_MathUtil.map(随机尺度, 0.0f, 1.0f, _最小尺度, _最大尺度);
        Vector3 随机尺度v3 = _原始尺度 * 随机尺度;

        transform.localScale = 随机尺度v3;
    }
Пример #6
0
    void BaseBehaviour()
    {
        float x  = NextGaussian(0.2f, 0.2f, 0, 0.1f);
        float y  = NextGaussian(0.3f, 0.3f, 0, 0.1f);
        float xx = AT_MathUtil.map(
            x,
            0.0f, 0.1f,
            -1.0f, 1.0f);
        float yy = AT_MathUtil.map(
            y,
            0.0f, 0.1f,
            -1.0f, 1.0f);

        transform.localScale += new Vector3(xx * 0.01f, yy * 0.01f, 0);
    }
Пример #7
0
    // Update is called once per frame
    void Update()
    {
        float nowTime = Time.realtimeSinceStartup;
        float angle   = Mathf.PerlinNoise(nowTime, noisePara);

        angle = AT_MathUtil.map(angle, 0.0f, 1.0f, 0, 180);
        transform.Rotate(Vector3.forward, angle);

        float x = radius.x * Mathf.Sin(2 * nowTime);
        float y = radius.x * Mathf.Cos(2 * nowTime);

        Vector3 nowPos = new Vector3(x, y, 0.0f);

        nowPos += pos;
        transform.localPosition = nowPos;
    }
Пример #8
0
    // Update is called once per frame
    void Update()
    {
        float 当前时刻_秒 = Time.realtimeSinceStartup;

        Vector3 随机化尺度 = _基准尺度;

        for (int i = 0; i < 3; i++)
        {
            Vector2 噪声位置   = _噪声起点[i] + 当前时刻_秒 * _噪声速率 [i];
            float   尺度改变   = Mathf.PerlinNoise(噪声位置.x, 噪声位置.y);
            float   尺度改变系数 = AT_MathUtil.map(
                尺度改变, 0, 1.0f, _最小尺度 [i], _最大尺度 [i]);
            随机化尺度 [i] *= 尺度改变系数;
        }

        transform.localScale = 随机化尺度;
    }
Пример #9
0
    // Update is called once per frame
    void Update()
    {
        float          时刻   = Time.realtimeSinceStartup;
        SpriteRenderer sr   = GetComponent <SpriteRenderer> ();
        Color          当前颜色 = sr.color;

        float 透明度 = 当前颜色.a;

        透明度 = Mathf.PerlinNoise(
            _噪声速率.x * 时刻, _噪声速率.y * 时刻);
        透明度 = AT_MathUtil.map(
            透明度,
            0.0f, 1.0f,
            _基准值 - _最大偏移,
            _基准值 + _最大偏移);
        当前颜色.a = 透明度;

        sr.color = 当前颜色;
    }
Пример #10
0
    // Update is called once per frame
    void Update()
    {
        float nowTime = Time.realtimeSinceStartup;

        float scale = Mathf.PerlinNoise(nowTime, noisePara);

        scale = AT_MathUtil.map(scale, 0.0f, 1.0f, minScale, maxScale);
        Vector3 v3 = preSize * scale;

        transform.localScale = v3;

        SpriteRenderer sr       = GetComponent <SpriteRenderer>();
        Color          nowColor = sr.color;

        nowColor.r = Mathf.PerlinNoise(
            nowTime, color[0]);
        nowColor.g = Mathf.PerlinNoise(
            nowTime, color[1]);
        nowColor.b = Mathf.PerlinNoise(
            nowTime, color[2]);
        nowColor.a = Mathf.PerlinNoise(
            nowTime, color[3]);
        sr.color = nowColor;
    }