コード例 #1
0
        private void TryToMovePlayer(float dx, float dy)
        {
            ILogicalPlayer tempPlayer = Player.CreateClone();
            bool           movePlayer = true;

            Vector2 delta = new Vector2(dx, dy);

            tempPlayer.Position += delta;

            if (Util.HasIntersection(tempPlayer, CurrentRoom.GetNonReflectingBounds()))
            {
                movePlayer = false;
            }
            if (Util.HasIntersection(tempPlayer, CurrentRoom.GetReflectingBounds()))
            {
                movePlayer = false;
            }
            if (Util.HasIntersection(tempPlayer, CurrentRoom.GetLightBounds()) && !_godMode)
            {
                movePlayer = false;
            }

            if (movePlayer)
            {
                Player.Position += delta;
            }
        }
コード例 #2
0
        private void CheckPlayerLightCollision()
        {
            if (_godMode)
            {
                return;
            }

            if (Util.HasIntersection(Player, CurrentRoom.GetLightBounds()))
            {
                StartReset();
            }
        }