示例#1
0
    void Start()
    {
        //GetComponent<SpriteRenderer>().sprite = sprites[Mathf.FloorToInt(Random.value * sprites.Length)];
        //GetComponent<SpriteRenderer>().sprite = sprites[RandUtil.Int(sprites.Length)];
        GetComponent <SpriteRenderer>().sprite = sprites.RandomValue();

        transform.position += (Vector3)(positionVariation * Random.insideUnitCircle);

        Rigidbody2D rigid = GetComponent <Rigidbody2D>();

        if (rigid != null)
        {
            GetComponent <Rigidbody2D>().velocity        = velocity + velocityVariation * Random.insideUnitCircle;
            GetComponent <Rigidbody2D>().angularVelocity = RandUtil.Variance(angularVelocity, angularVelocityVariation);
        }
    }