当前位置: 首页>>代码示例>>C#>>正文


C# Room.GetType方法代码示例

本文整理汇总了C#中Room.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Room.GetType方法的具体用法?C# Room.GetType怎么用?C# Room.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Room的用法示例。


在下文中一共展示了Room.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AttemptedExit

 public override bool AttemptedExit(Room target)
 {
     if (target.GetType() == typeof (WhippingPlatform) || target.GetType() == typeof (Chapter5Begin))
         return true;
     if (!hastried)
     {
         Terminal.WriteLine("As you move towards the road, the guard roughly grabs you and shoves you back.");
         Terminal.WriteLine("He says, \"Don't even think about trying to escape!\"");
         hastried = true;
         return false;
     }
     Terminal.WriteLine("As you try to escape, the guard draws his pistol and shoots you dead.");
     Terminal.RestartFromLastCheckpoint<Chapter5Begin>();
     return false;
 }
开发者ID:Phyxius,项目名称:Text-Adventure,代码行数:15,代码来源:Chapter5.cs

示例2: Update

        //Update camera position depending on the kind of room you are in + playership position
        public void Update(Vector2 shippos, Room room)
        {
            if (room.GetType() == typeof(BigRoom))
            {
                _target = (shippos - (Globals.Screensize / 2));
                if (_target.X < room.Position.X) _target.X = room.Position.X;
                else if (_target.X > room.Bounds.Right - (Globals.Screensize.X))
                         _target.X = room.Bounds.Right - (Globals.Screensize.X);

                if (_target.Y < room.Position.Y) _target.Y = room.Position.Y;
                else if (_target.Y > room.Bounds.Bottom - (Globals.Screensize.Y))
                         _target.Y = room.Bounds.Bottom - (Globals.Screensize.Y);

            }
            else if (room.GetType() == typeof(Corridor))
            {
                _target = (shippos - (Globals.Screensize / 2));

                if (_target.X < room.Bounds.X) _target.X = room.Bounds.X;
                else if (_target.X > room.Bounds.Right - (Globals.Screensize.X))
                    _target.X = room.Bounds.Right - (Globals.Screensize.X);

                if (_target.Y < room.Bounds.Y) _target.Y = room.Bounds.Y;
                else if (_target.Y > room.Bounds.Bottom - (Globals.Screensize.Y))
                    _target.Y = room.Bounds.Bottom - (Globals.Screensize.Y);

                if (room.COrientation.Orient == (int)Globals.Orientation.Vert)
                    _target.X = room.COrientation.Bounds.Center.X - (Globals.Screensize.X / 2);
                else if (room.COrientation.Orient == (int)Globals.Orientation.Horz)
                    _target.Y = room.COrientation.Bounds.Center.Y - (Globals.Screensize.Y / 2);
                else if (room.COrientation.Orient == (int)Globals.Orientation.RightDown)
                {
                    if (isRightDown(new Point(room.COrientation.Bounds.Right, room.COrientation.Bounds.Top),
                        new Point(room.COrientation.Bounds.Right - 1, room.COrientation.Bounds.Top + 1)
                        , new Point((int)shippos.X, (int)shippos.Y)))
                    {
                        _target.Y = room.COrientation.Bounds.Top + (room._halfwidth * Globals.SmallGridSize.Y) - (Globals.Screensize.Y / 2);
                    }
                    else
                    {
                        _target.X = room.COrientation.Bounds.Right - (room._halfwidth * Globals.SmallGridSize.X) - (Globals.Screensize.X / 2);
                    }
                }
                else if (room.COrientation.Orient == (int)Globals.Orientation.RightUp)
                {
                    if (isRightDown(new Point(room.COrientation.Bounds.Right, room.COrientation.Bounds.Bottom),
                        new Point(room.COrientation.Bounds.Right-1, room.COrientation.Bounds.Bottom -1),
                        new Point((int)shippos.X,(int)shippos.Y)))
                    {
                        _target.X = room.COrientation.Bounds.Right - (room._halfwidth * Globals.SmallGridSize.X) - (Globals.Screensize.X / 2);

                    }
                    else
                    {
                        _target.Y = room.COrientation.Bounds.Bottom - (room._halfwidth * Globals.SmallGridSize.Y) - (Globals.Screensize.Y / 2);
                    }
                }
                else if (room.COrientation.Orient == (int)Globals.Orientation.DownRight)
                {
                    if (isRightDown(new Point(room.COrientation.Bounds.Left, room.COrientation.Bounds.Bottom),
                        new Point(room.COrientation.Bounds.Left +1, room.COrientation.Bounds.Bottom - 1)
                        , new Point((int)shippos.X, (int)shippos.Y)))
                    {
                        _target.Y = room.COrientation.Bounds.Bottom - (room._halfwidth * Globals.SmallGridSize.Y) - (Globals.Screensize.Y / 2);

                    }
                    else
                    {
                        _target.X = room.COrientation.Bounds.Left + (room._halfwidth * Globals.SmallGridSize.X) - (Globals.Screensize.X / 2);
                    }
                }
                else if (room.COrientation.Orient == (int)Globals.Orientation.UpRight)
                {
                    if (isRightDown(new Point(room.COrientation.Bounds.Left, room.COrientation.Bounds.Top),
                        new Point(room.COrientation.Bounds.Left + 1, room.COrientation.Bounds.Top + 1)
                        , new Point((int)shippos.X, (int)shippos.Y)))
                    {
                        _target.X = room.COrientation.Bounds.Left + (room._halfwidth * Globals.SmallGridSize.X) - (Globals.Screensize.X / 2);
                    }
                    else
                    {
                        _target.Y = room.COrientation.Bounds.Top + (room._halfwidth * Globals.SmallGridSize.Y) - (Globals.Screensize.Y / 2);
                    }
                }

            }
            else
            {
                _target = Globals.CurrentLevel.CurrentRoom.Position;
                _lasttarget = _target;
            }

            if (!_changing)
            {
                checktarget();
            }
            _changing = false;

            _lasttarget = _target;
//.........这里部分代码省略.........
开发者ID:Wonko-the-sane,项目名称:Artefact001,代码行数:101,代码来源:Camera.cs

示例3: AttemptedExit

 public override bool AttemptedExit(Room target)
 {
     if (target.GetType() == typeof (ElDoradoIntermission))
         return true;
     Terminal.WriteLine("Wait! You haven't finished your dinner!");
     return false;
 }
开发者ID:Phyxius,项目名称:Text-Adventure,代码行数:7,代码来源:Chapter16.cs

示例4: AttemptedExit

 public override bool AttemptedExit(Room target)
 {
     if (target.GetType() == typeof (Chapter16Start))
         return true;
     if (Items.Contains(brother))
         return true;
     Terminal.WriteLine("As you attempt to leave, Cunegonde's borther stabs you dead.");
     if (Inventory.Count == 0)
         Terminal.WriteLine("If only you had a sword! Then you could kill him before he killed you.");
     Terminal.RestartFromLastCheckpoint<Chapter15Start>();
     return false;
 }
开发者ID:Phyxius,项目名称:Text-Adventure,代码行数:12,代码来源:Chapter11.cs


注:本文中的Room.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。