Beispiel #1
0
        public void CarvePath(VectorBase from, VectorBase to, TileType floorTile)
        {
            var los = new Los(from, to);

            foreach (var pos in los)
            {
                if (pos == to)
                {
                    break;
                }

                VectorBase position = (VectorBase)pos;

                // Make slightly wider passages.
                SetTile(position, floorTile);
                if (position.x + 1 < stage.Width)
                {
                    SetTile(position.offsetX(1), floorTile);
                }
                if (position.y + 1 < stage.Height)
                {
                    SetTile(position.offsetY(1), floorTile);
                }
            }
        }
Beispiel #2
0
        public void CarveLine(VectorBase start, VectorBase end, TileType floorTile)
        {
            var los = new Los(start, end);

            foreach (var point in los.Points)
            {
                SetTile(point, floorTile);
            }
        }
Beispiel #3
0
        private static void TestLos(Debugger debugger)
        {
            // Line of Sight Testing
            var position = new VectorBase(67, 14);
            var target   = new VectorBase(69, 16);
            var los      = new Los(position, target);

            foreach (var point in los.Points)
            {
                debugger.Info($"point: [{point.x},{point.y}]");
            }
        }
Beispiel #4
0
        private VectorBase LineIntersectsLine(VectorBase l1p1, VectorBase l1p2, VectorBase l2p1, VectorBase l2p2)
        {
            var intersectingLine = new Los(l1p1, l1p2);

            var queryingLine = new Los(l2p1, l2p2);

            foreach (var point in intersectingLine.Points)
            {
                if (queryingLine.Points.Contains(point))
                {
                    return(point);
                }
            }

            return(null);
        }
Beispiel #5
0
        private void FireTowards(Direction dir)
        {
            // TODO: When there is more than one usable command, bring up the
            // SelectCommandDialog. Until then, just pick the first valid one.
            var command = _gameState.Game.Hero.HeroClass.Commands.FirstOrDefault(c => c.CanUse(_gameState.Game));

            if (command == null)
            {
                _gameState.Game.Log.Error("You don't have any commands you can perform.");
                return;
            }

            if (command is DirectionCommand)
            {
                var directionCommand = command as DirectionCommand;
                _gameState.Game.Hero.SetNextAction(directionCommand.GetDirectionAction(_gameState.Game, dir));
                return;
            }

            if (command is TargetCommand)
            {
                var pos = _gameState.Game.Hero.Position + dir;

                // Target the monster that is in the fired direction.
                var los = new Los(_gameState.Game.Hero.Position, pos);
                foreach (var step in los)
                {
                    // Stop if we hit a wall.
                    if (!_gameState.Game.CurrentStage[(VectorBase)step].IsTransparent)
                    {
                        break;
                    }

                    // See if there is an actor there.
                    var actor = _gameState.Game.CurrentStage.ActorAt((VectorBase)step);
                    if (actor != null)
                    {
                        _gameState.Game.Target = actor;
                        break;
                    }
                }

                var targetCommand = command as TargetCommand;
                _gameState.Game.Hero.SetNextAction(targetCommand.GetTargetAction(_gameState.Game, pos));
            }
        }
Beispiel #6
0
            public static MessageBoxResult Nazwa(string value)
            {
                MessageBoxResult w1 = MessageBoxResult.None;
                var los             = Los.Liczba();

                if (los == 1 && value == "p1")
                {
                    w1 = MessageBox.Show($"wylosowano liczbę {los} - bomba jest ukryta pod przyciskiem {value}", "Bomba",
                                         MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if (los == 2 && value == "p2")
                {
                    w1 = MessageBox.Show($"wylosowano liczbę {los} - bomba jest ukryta pod przyciskiem {value}", "Bomba",
                                         MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if (los == 3 && value == "p3")
                {
                    w1 = MessageBox.Show($"wylosowano liczbę {los} - bomba jest ukryta pod przyciskiem {value}", "Bomba",
                                         MessageBoxButton.OK, MessageBoxImage.Error);
                }

                return(w1);
            }
Beispiel #7
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (Id.Length != 0)
        {
            hash ^= Id.GetHashCode();
        }
        if (AgeYears != 0)
        {
            hash ^= AgeYears.GetHashCode();
        }
        if (AgeDays != 0)
        {
            hash ^= AgeDays.GetHashCode();
        }
        if (BirthDate != 0)
        {
            hash ^= BirthDate.GetHashCode();
        }
        if (AdmDate != 0)
        {
            hash ^= AdmDate.GetHashCode();
        }
        if (SepDate != 0)
        {
            hash ^= SepDate.GetHashCode();
        }
        if (LeaveDays != 0)
        {
            hash ^= LeaveDays.GetHashCode();
        }
        if (Sex.Length != 0)
        {
            hash ^= Sex.GetHashCode();
        }
        if (Adm.Length != 0)
        {
            hash ^= Adm.GetHashCode();
        }
        if (Sep.Length != 0)
        {
            hash ^= Sep.GetHashCode();
        }
        if (Gestage != 0)
        {
            hash ^= Gestage.GetHashCode();
        }
        if (Los != 0)
        {
            hash ^= Los.GetHashCode();
        }
        if (Hmv != 0)
        {
            hash ^= Hmv.GetHashCode();
        }
        if (Bh != false)
        {
            hash ^= Bh.GetHashCode();
        }
        hash ^= diagnoses_.GetHashCode();
        hash ^= procedures_.GetHashCode();
        if (_unknownFields != null)
        {
            hash ^= _unknownFields.GetHashCode();
        }
        return(hash);
    }