Exemplo n.º 1
0
 protected override void Begin()
 {
     base.Begin();
     Coord.Subscribe(c => Move());
     SquareOver.Subscribe(sq =>
     {
         if (sq != null)
         {
             BoardView.ShowSquares(Agent.Model.Card, sq);
         }
     }).AddTo(this);
 }
Exemplo n.º 2
0
        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);
        }