Flip() public method

Activates the flip and returns true or false depending on if the expected choice was chosen.
public Flip ( ) : bool
return bool
        private void CreateBillboardIfEliglible(IBillboardBuilder builder, Vector3 position, Vector2 area)
        {
            if (builder.HasBillboards())
            {
                var northSouthSideLength = area.X;
                var eastWestSideLength   = area.Y;
                if (northSouthSideLength > eastWestSideLength)
                {
                    if (northSouthSideLength >= builder.CalculateBillboardWidth(3))
                    {
                        var billboard = CoinFlip.Flip() ?
                                        builder.CreateNorthFacingBillboard(position, area, 3) :
                                        builder.CreateSouthFacingBillboard(position, area, 3);

                        _meshes.AddRange(billboard.Meshes);
                    }
                }
                else
                {
                    if (eastWestSideLength >= builder.CalculateBillboardWidth(3))
                    {
                        var billboard = CoinFlip.Flip() ?
                                        builder.CreateWestFacingBillboard(position, area, 3) :
                                        builder.CreateEastFacingBillboard(position, area, 3);

                        _meshes.AddRange(billboard.Meshes);
                    }
                }
            }
        }
示例#2
0
    /// <summary>
    /// Initializes all variables needed to run the script.
    /// </summary>
    void Start ()
    {
        GameObject GameController = GameObject.FindGameObjectWithTag("GameController");
        BR = GameController.GetComponent<BallReset>();
        GT = GameController.GetComponent<GameTimer>();
        
        CF = new CoinFlip();
        if (CF.Flip())
        {
            // Red team won toss, blue will get ball next half
            ball.GetComponent<Possession>().SetNextHalfPossession(Possession.Team.blue);
            // Give the ball to the red team
            BR.placeBallRSC();
        }
        else
        {
            // Blue team won toss, red will get the ball next half
            ball.GetComponent<Possession>().SetNextHalfPossession(Possession.Team.red);
            // Give the ball to the blue team
            BR.placeBallBSC();
        }

        setupDone = true;
    }