public override bool AddSubscriptions() { Agent.Power.Subscribe(p => Power.text = $"{p}").AddTo(this); Agent.Health.Subscribe(p => Health.text = $"{p}").AddTo(this); //agent.Model.ManaCost.Subscribe(p => Mana.text = $"{p}").AddTo(this); MouseOver.DistinctUntilChanged().Subscribe( v => { //BoardView.ShowSquares(this); } ); Dead.Subscribe(dead => { if (!dead) { return; } Info($"{Agent.Model} died"); _Queue.Sequence(Cmd.Do(() => _AudioSource.PlayOneShot(DiedClip))); BoardView.Remove(this); }); return(true); }
public override void SetAgent(IPlayerView view, IPieceAgent agent) { base.SetAgent(view, agent); Assert.IsNotNull(agent); Assert.IsNotNull(agent.Power); Assert.IsNotNull(agent.Health); Assert.IsNotNull(Power); Assert.IsNotNull(Health); agent.Power.Subscribe(p => Power.text = $"{p}").AddTo(this); agent.Health.Subscribe(p => Health.text = $"{p}").AddTo(this); //agent.Model.ManaCost.Subscribe(p => Mana.text = $"{p}").AddTo(this); FindPiece().GetComponent <Renderer>().material = Owner.Value.Color == EColor.Black ? BoardView.BlackMaterial : BoardView.WhiteMaterial; MouseOver.DistinctUntilChanged().Subscribe( v => { //BoardView.ShowSquares(this); } ); Dead.Subscribe(d => { if (d) { Die(); } }); }
public PieceModel(IPlayerModel player, ICardModel card) : base(player) { Card = card; Dead.Subscribe(dead => { if (dead) { Died(); } }).AddTo(this); }
public PieceModel(IOwner player, ICardModel card) : base(player) { Card = card; Dead.Subscribe(dead => { if (dead) { Died(); } }); // TODO ADDTO .AddTo(); }