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


C# Area.SetPlayerStartLocation方法代码示例

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


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

示例1: OnUpdateFrame

        public void OnUpdateFrame(FrameEventArgs e, KeyboardDevice Keyboard, MouseDevice Mouse)
        {
            if (!fadingOut && fadeBox.Color.A > 0)
            {
                fadeBox.Color = new Color4(0, 0, 0, fadeBox.Color.A - (float)e.Time * fadeTime);
            }

            if (fadingOut)
            {
                if (fadeBox.Color.A < 1)
                    fadeBox.Color = new Color4(0, 0, 0, fadeBox.Color.A + (float)e.Time * fadeTime);
                else
                {
                    if (gameWon)
                    {
                        MainWindow.state = new EndMenuState();
                        Resources.StopAllAudio();
                        //Resources.UnloadAudioBuffers();
                    }
                    else
                    {
                        Type oldAreaType = area.GetType();
                        area.Unload();
                        area = tempNewArea;
                        area.LoadContent(data);
                        player.MoveTo(area.SetPlayerStartLocation(oldAreaType));
                        GL.ClearColor(area.ClearColor);
                        fadingOut = false;
                    }
                }

            }

            player.Moving = false;

            if (Keyboard[Key.Up])
            {
                player.MoveBy(new Vector2(0, (float)(e.Time * Player.MoveSpeed)));
                player.Moving = true;
            }

            if (Keyboard[Key.Down])
            {
                player.MoveBy(new Vector2(0, -(float)(e.Time * Player.MoveSpeed)));
                player.Moving = true;
            }

            if (Keyboard[Key.Left])
            {
                player.MoveBy(new Vector2(-(float)(e.Time * Player.MoveSpeed), 0));
                player.Moving = true;
            }

            if (Keyboard[Key.Right])
            {
                player.MoveBy(new Vector2((float)(e.Time * Player.MoveSpeed), 0));
                player.Moving = true;
            }

            c.Update(e.Time);
            player.Update(e.Time);

            message = string.Empty;

            foreach (TriggerChangeArea trigger in area.AreaChangeTriggers)
            {
                if (PhysicsManager.IsColliding(player.BoundingBox, trigger.BBox))
                {
                    tempNewArea = trigger.Area;
                    fadingOut = true;
                    break;
                }
            }

            foreach (TriggerButtonPress trigger in area.ButtonPressTriggers)
            {
                if (PhysicsManager.IsColliding(player.BoundingBox, trigger.BBox))
                {
                    trigger.Button.Activated = true;
                }

                else
                {
                    if (trigger.Button.Activated)
                    {
                        trigger.Activate();
                    }
                }
            }

            foreach (TriggerEndgame trigger in area.EndgameTrigger)
            {
                if (PhysicsManager.IsColliding(player.BoundingBox, trigger.BBox))
                {
                    if (Keyboard[Key.Z])
                    {
                        fadingOut = true;
                        gameWon = true;
                    }
                    else
//.........这里部分代码省略.........
开发者ID:Robmaister,项目名称:RoversSpirit,代码行数:101,代码来源:WorldState.cs


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