RXRandom.Float C# (CSharp) Méthode

Float() public static méthode

public static Float ( ) : float
Résultat float
    public static float Float()
    {
        return (float)_randomSource.NextDouble();
    }

Same methods

RXRandom::Float ( float max ) : float

Usage Example

Exemple #1
0
    public Player(bool isControllable = false)
        : base("player")
    {
        playerBlip          = new FSprite("playerBlip");
        hair                = new FSprite("hair");
        this.isControllable = isControllable;
        addAnimation(new FAnimation("idle", new int[] { 0 }, 100, true));
        addAnimation(new FAnimation("pistol", new int[] { 1 }, 100, true));
        addAnimation(new FAnimation("shotgun", new int[] { 2 }, 100, true));
        addAnimation(new FAnimation("machinegun", new int[] { 3 }, 100, true));


        powerupClock = new PowerupClock();
        if (isControllable)
        {
            playerBlip.color = Color.green;
            play("pistol");
            shadow     = new FSprite("player_1");
            hair.color = Color.black;

            powerupClock.percentage = 0;
        }
        else
        {
            playerBlip.color = Color.red;
            play("idle");
            hair.color = new Color(RXRandom.Float() * .5f, RXRandom.Float() * .5f, RXRandom.Float() * .5f);
            float randomColorMult = .5f + RXRandom.Float() * .5f;
            this.color = new Color(randomColorMult, randomColorMult, randomColorMult);
            shadow     = new FSprite("player_0");
        }

        shadow.color = new Color(0, 0, 0, .5f);
    }
All Usage Examples Of RXRandom::Float