コード例 #1
0
    public PlayerModel(Settings playerSettings, ShipModel.Factory shipFactory)
    {
        //order of initilaization is based on object graph, if object A is injected into B A is initalized first !

        ModelSettings = playerSettings;

        RxPlayerName = new ReactiveProperty<string>(playerSettings.playerName);
        RxPlayerScore = new ReactiveProperty<int>(playerSettings.initialScore);
        RxPlayerState = new ReactiveProperty<PlayerState>(PlayerState.Inactive);

        PlayerShip = shipFactory.Create(this, playerSettings.shipSettings);

        PlayerShip.RxShipState.Where(x => x == ShipModel.ShipState.Dead).Subscribe(x => { Deactivate(); });
    }