public override void Do()
        {
            this.m_oldFocus = FPGA.FPGA.Instance.Current;
            Tile current = FPGA.FPGA.Instance.Current;

            Types.Direction direction = Types.ParseDirectionFromString(this.DirectionString);

            while (true)
            {
                TileKey targetKey = V5Navigator.GetDestination(current, direction, 1);
                if (!FPGA.FPGA.Instance.Contains(targetKey))
                {
                    throw new ArgumentException("Left FPGA during navigation from " + current + " in direction " + direction);
                }

                current = FPGA.FPGA.Instance.GetTile(targetKey);
                if (!FPGA.FPGA.Instance.Contains(current.TileKey))
                {
                    throw new ArgumentException("Leaving FPGA");
                }
                if (current.Location.StartsWith(this.TargetPrefix))
                {
                    FPGA.FPGA.Instance.Current = current;
                    break;
                }
            }
        }
示例#2
0
            // Update is called once per frame
            void Update()
            {
                // If the object is being moved, we assign the movement direction as the current orientation
                if (positionable.Movement != null && positionable.Movement != orientation)
                {
                    orientation = positionable.Movement.Value;
                }

                // Given an animation change or an orientation change, we change the animation
                if (animationKey != previousAnimationKey || orientation != previousOrientation)
                {
                    SetCurrentAnimation();
                }

                previousOrientation  = orientation;
                previousAnimationKey = animationKey;
            }
示例#3
0
        public TrackedMessage(UInt32 position, object message, PID sender, Types.Direction direction)
        {
            millisFromEpoch_ = DateTime.UtcNow.ToEpochMillis();
            Position         = position;
            Sender           = sender;
            Direction        = direction;
            Message.Add("sequence", Position.ToString());

            switch (message)
            {
            //case IChunk chunk:
            //{
            //    Message.Add("type",
            //        $"{chunk.Payload?.GetType()} @{chunk.Position}: {chunk.PartitionId} # {chunk.Index}");
            //    break;
            //}

            case Terminated terminated:
            {
                Message.Add("type", $"{message.GetType().FullName} => {terminated.Who.ToShortString()}");
                break;
            }

            default:
            {
                Message.Add("type", message.GetType().FullName);
                break;
            }
            }

            Message.Add("when", EpochUtils.FromMillis(MillisFromEpoch).ToString("O"));

            if (Sender != null)
            {
                Message.Add("sender", Sender.ToShortString());
            }

            try
            {
                Message.Add("message", JsonConvert.SerializeObject(message, JsonSerializerSettings));
            }
            catch (Exception ex)
            {
                Message.Add("message", $"Error serializing message : {ex.Message}");
            }
        }
        public override void Do()
        {
            this.m_oldFocus = FPGA.FPGA.Instance.Current;
            Tile current = FPGA.FPGA.Instance.Current;
            Types.Direction direction = Types.ParseDirectionFromString(this.DirectionString);

            while (true)
            {
                TileKey targetKey = V5Navigator.GetDestination(current, direction, 1);
                if (!FPGA.FPGA.Instance.Contains(targetKey))
                    throw new ArgumentException("Left FPGA during navigation from " + current + " in direction " + direction);

                current = FPGA.FPGA.Instance.GetTile(targetKey);
                if (!FPGA.FPGA.Instance.Contains(current.TileKey))
                {
                    throw new ArgumentException("Leaving FPGA");
                }
                if (System.Text.RegularExpressions.Regex.IsMatch(current.Location, this.Regex))
                {
                    FPGA.FPGA.Instance.Current = current;
                    break;
                }
            }
        }
示例#5
0
        public char DoorCharacter(Types.Direction direction)
        {
            DoorCoords doorCoords = DoorCoordinates[direction];

            return(Template[doorCoords.row][doorCoords.col]);
        }