Ejemplo n.º 1
0
        /// <summary>
        /// Looks at a particular tile, detecting if NPCs are present as well
        /// Provides string output or special instructions if it is "special"B
        /// </summary>
        /// <param name="xy">positon of tile to look at</param>
        /// <param name="specialLookCommand">Special command such as look at gem or sign</param>
        /// <returns>String to output to user</returns>
        public string Look(Point2D xy, out SpecialLookCommand specialLookCommand)
        {
            specialLookCommand = SpecialLookCommand.None;

            TileReference tileReference = State.TheVirtualMap.GetTileReference(xy);

            // if there is an NPC on the tile, then we assume they want to look at the NPC, not whatever else may be on the tiles
            if (State.TheVirtualMap.IsNPCTile(xy))
            {
                MapCharacter mapCharacter = State.TheVirtualMap.GetNPCOnTile(xy);
                return(DataOvlRef.StringReferences.GetString(DataOvlReference.VISION2_STRINGS.THOU_DOST_SEE).Trim()
                       + " " + (LookRef.GetLookDescription(mapCharacter.NPCRef.NPCKeySprite).Trim()));
            }
            // if we are any one of these signs then we superimpose it on the screen
            else if (SpriteTileReferences.IsSign(tileReference.Index))
            {
                specialLookCommand = SpecialLookCommand.Sign;
                return(String.Empty);
            }
            else if (SpriteTileReferences.GetTileNumberByName("Clock1") == tileReference.Index)
            {
                return(DataOvlRef.StringReferences.GetString(DataOvlReference.VISION2_STRINGS.THOU_DOST_SEE).Trim()
                       + " " + (LookRef.GetLookDescription(tileReference.Index).TrimStart()
                                + State.TheTimeOfDay.FormattedTime));
            }
            else // lets see what we've got here!
            {
                return(DataOvlRef.StringReferences.GetString(DataOvlReference.VISION2_STRINGS.THOU_DOST_SEE).Trim()
                       + " " + (LookRef.GetLookDescription(tileReference.Index).TrimStart()));
            }
        }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        //spelling_flag = paRef.doingRitual;

            //moving player
            hAxis = Input.GetAxis("Horizontal");
            vAxis = Input.GetAxis("Vertical");

            if (!spelling_flag) {
                if (hAxis != 0) {
                    transform.position = new Vector2 (transform.position.x + (speed * Time.deltaTime) * hAxis, transform.position.y);
                    if (hAxis > 0f) {
                        lRef = LookRef.right;
                    }
                    if (hAxis < 0f) {
                        lRef = LookRef.left;
                    }
                    anim.SetBool("walking", true);
                }
                if (vAxis != 0) {
                    transform.position = new Vector2(transform.position.x, transform.position.y + (speed * Time.deltaTime) * vAxis);
                    anim.SetBool("walking", true);
                }
                if (hAxis == 0 && vAxis == 0) {
                    anim.SetBool ("walking", false);
                }

            }

            //fliping player
            if (lRef == LookRef.right) {
                Vector2 scale = new Vector2 (playerScale, playerScale);
                paRef.spellText.transform.localScale = scale;
                transform.localScale = scale;

            } else if (lRef == LookRef.left) {
                Vector2 scale = new Vector2 (playerScale * -1, playerScale);
                paRef.spellText.transform.localScale = scale;
                transform.localScale = scale;
            }
            if (Input.GetButtonDown ("Fire1")) {
                Vector3 mousePos = Camera.main.ScreenToWorldPoint (Input.mousePosition);
                if (mousePos.x > transform.position.x)
                    lRef = LookRef.right;
                else if (mousePos.x < transform.position.x)
                    lRef = LookRef.left;
            }
    }
Ejemplo n.º 3
0
        /// <summary>
        /// Looks at a particular tile, detecting if NPCs are present as well
        /// Provides string output or special instructions if it is "special"B
        /// </summary>
        /// <param name="xy">position of tile to look at</param>
        /// <param name="specialLookCommand">Special command such as look at gem or sign</param>
        /// <returns>String to output to user</returns>
        public string Look(Point2D xy, out SpecialLookCommand specialLookCommand)
        {
            specialLookCommand = SpecialLookCommand.None;
            string retStr;

            TileReference tileReference = State.TheVirtualMap.GetTileReference(xy);

            // if there is an NPC on the tile, then we assume they want to look at the NPC, not whatever else may be on the tiles
            if (State.TheVirtualMap.IsNPCTile(xy))
            {
                MapCharacter mapCharacter = State.TheVirtualMap.GetNPCOnTile(xy);
                if (mapCharacter == null)
                {
                    throw new Ultima5ReduxException("Tried to look up NPC, but couldn't find the map character");
                }
                retStr = DataOvlRef.StringReferences.GetString(DataOvlReference.Vision2Strings.THOU_DOST_SEE).Trim()
                         + " " + (LookRef.GetLookDescription(mapCharacter.NPCRef.NPCKeySprite).Trim());
            }
            // if we are any one of these signs then we superimpose it on the screen
            else if (SpriteTileReferences.IsSign(tileReference.Index))
            {
                specialLookCommand = SpecialLookCommand.Sign;
                retStr             = string.Empty;
            }
            else if (SpriteTileReferences.GetTileNumberByName("Clock1") == tileReference.Index)
            {
                retStr = (DataOvlRef.StringReferences.GetString(DataOvlReference.Vision2Strings.THOU_DOST_SEE).Trim()
                          + " " + (LookRef.GetLookDescription(tileReference.Index).TrimStart()
                                   + State.TheTimeOfDay.FormattedTime));
            }
            else // lets see what we've got here!
            {
                retStr = (DataOvlRef.StringReferences.GetString(DataOvlReference.Vision2Strings.THOU_DOST_SEE).Trim()
                          + " " + (LookRef.GetLookDescription(tileReference.Index).TrimStart()));
            }

            // pass time at the end to make sure moving characters are accounted for
            PassTime();
            return(retStr);
        }