Пример #1
0
        private void TryProcessNextTile(CTile tile)
        {
            var ap      = this._data.Char.Proxy.GetPoints(ESecondaryStat.AP);
            var stamina = this._data.Char.Proxy.GetPoints(ESecondaryStat.Stamina);
            var model   = (MTile)this._data.TargetPath.GetNextTile(tile.Model);

            if (model != null)
            {
                this._next = model.Controller;
                var apCost   = this._next.Model.GetCost();
                var stamCost = this._next.Model.GetStaminaCost();
                if (apCost <= ap && stamCost <= stamina)
                {
                    var data = new EvTileMoveData();
                    data.Cost       = apCost;
                    data.Char       = this._data.Char;
                    data.ParentMove = this;
                    data.Source     = this._current;
                    data.StamCost   = this._data.Target.Model.GetStaminaCost();
                    data.Target     = this._next;
                    var e = new EvTileMove(data);
                    e.AddCallback(this.TileMoveDone);
                    e.TryProcess();
                }
                else
                {
                    this.TryDone(null);
                }
            }
            else
            {
                this.TryDone(null);
            }
        }
Пример #2
0
 private void TryProcessFirstTile()
 {
     if (this._data.Source != null)
     {
         var ap      = this._data.Char.Proxy.GetPoints(ESecondaryStat.AP);
         var stamina = this._data.Char.Proxy.GetPoints(ESecondaryStat.Stamina);
         var tile    = this._data.TargetPath.GetFirstTile() as MTile;
         this._next = tile.Controller;
         var apCost   = this._next.Model.GetCost();
         var stamCost = this._next.Model.GetStaminaCost();
         if (apCost <= ap && stamCost <= stamina)
         {
             var data = new EvTileMoveData();
             data.Cost       = apCost;
             data.Char       = this._data.Char;
             data.ParentMove = this;
             data.Source     = this._data.Source;
             data.Target     = this._next;
             var e = new EvTileMove(data);
             e.AddCallback(this.TileMoveDone);
             this.AddChildAction(e);
             e.TryProcess();
         }
         else
         {
             this.TryDone(null);
         }
     }
 }