コード例 #1
0
        //can move foreward and handle load
        public override bool Move()
        {
            if (this.CanMove)
            {
                if (currentPlace.Next != null)
                {
                    StaticObject prev = this.CurrentPlace;
                    this.currentPlace.Next.PlaceObject(this);

                    prev.Object = null;
                    prev.SetSymbol();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                if (this.Load > 7)
                {
                    this.CanMove = true;
                    this.Symbol  = loadedSymbol;
                    this.CurrentPlace.SetSymbol();
                    Move();

                    this.PierRail.BringInShip();
                    return(true);
                }
            }
            return(true);
        }
コード例 #2
0
ファイル: Wagon.cs プロジェクト: gitHub-Randy/GoudkoortsV2
        public override bool Move()
        {
            if (this.CanMove)
            {
                if (currentPlace.Next != null)
                {
                    StaticObject prev = this.CurrentPlace;

                    if (this.currentPlace.Next.PlaceObject(this))
                    {
                        this.currentPlace.SetSymbol();
                        prev.Object = null;
                        prev.SetSymbol();
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }