protected override void Begin() { base.Begin(); Coord.Subscribe(c => Move()); SquareOver.Subscribe(sq => { if (sq != null) { BoardView.ShowSquares(Agent.Model.Card, sq); } }).AddTo(this); }
private void AddCardSubscriptions() { MouseOver.Subscribe(v => _mouseOver.Value = v).AddTo(this); 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); SquareOver.Subscribe(sq => { if (sq != null) { BoardView.ShowSquares(Agent.Model, sq); } }).AddTo(this); }
protected override bool Begin() { if (!base.Begin()) { return(false); } Coord.Subscribe(c => Move()); SquareOver.Subscribe(sq => { if (sq != null) { BoardView.ShowSquares(Agent.Model.Card, sq); } }).AddTo(this); return(true); }
public override void SetAgent(IPlayerView view, ICardAgent agent) { base.SetAgent(view, agent); _mana = FindTextChild("Mana"); _health = FindTextChild("Health"); _power = FindTextChild("Power"); if (_mana == null) { Error("No Mana text child for {0}", this); return; } if (_health == null) { Error("No Health text child for {0}", this); return; } if (_power == null) { Error("No Power text child for {0}", this); return; } base.MouseOver.Subscribe(v => _mouseOver.Value = v as ICardView).AddTo(this); Assert.IsNotNull(agent); 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().material = Owner.Value.Color == EColor.Black ? BoardView.BlackMaterial : BoardView.WhiteMaterial; SquareOver.Subscribe(sq => { if (sq != null) { BoardView.ShowSquares(Agent.Model, sq); } }).AddTo(this); Assert.IsTrue(IsValid); }