Esempio n. 1
0
    /// <summary>
    /// Performs initialization of Game object.
    /// </summary>
    public void Initialize(GameMode gameMode)
    {
        this.gameMode = gameMode;
        this.state    = new NoState(this);
        gc            = GameObject.Find(GameController.NAME).GetComponent <GameController>();

        // Initialize fields
        this.holeBag           = new HoleBag(gameMode);
        this.itemBag           = new ItemBag("good");
        this.badItemBag        = new ItemBag("bad");
        this.playerAttributes  = new PlayerAttributes();
        this.terrainAttributes = new TerrainAttributes();

        inputController = new InputController(this);
        target          = Target.BALL;

        wind            = new Wind(this);
        ball            = new Ball(this);
        cursor          = new Cursor(this);
        currentDistance = new CurrentDistance(this);
        bag             = new Bag(this);
        powerbar        = new Powerbar(this);
        shotMode        = new ShotMode(this);
        score           = new Score(this);

        // Send Game reference to other objects
        GodOfUI ui = GameObject.Find(GodOfUI.NAME).GetComponent <GodOfUI>();

        ui.gameRef = this;
    }
Esempio n. 2
0
    public void AddCurrentHole()
    {
        HoleBag holeBag  = game.GetHoleBag();
        string  holeName = SceneManager.GetActiveScene().name;
        float   hcp      = holeBag.GetHandicap(holeName);

        holeBag.AddHole(new HoleData(holeName, tee, lengthFront, lengthBack, par, hcp));
    }
Esempio n. 3
0
 public void SetHoleBag(HoleBag holeBag)
 {
     this.holeBag = holeBag;
 }