private RoomEnterExitState(EnterExitType type, int walkDirection, float walkDistance, float walkSpeed, Message enterMessage = null)
 {
     this.type			= type;
     this.enterMessage	= enterMessage;
     this.walkDirection	= walkDirection;
     this.walkDistance	= walkDistance;
     this.walkSpeed		= walkSpeed;
 }
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        // Constructs a text reader with the specified message
        public RoomStateTextReader(Message message, int linesPerWindow = 2)
        {
            this.updateRoom			= false;
            this.animateRoom		= true;

            this.message			= message;
            this.wrappedString		= GameData.FONT_LARGE.WrapString(message.Text, 128);
            this.timer				= 0;
            this.arrowTimer			= 0;

            this.linesPerWindow		= linesPerWindow;
            this.windowLinesLeft	= this.linesPerWindow;
            this.windowLine			= 0;
            this.currentLine		= 0;
            this.currentChar		= 0;
            this.state				= TextReaderState.WritingLine;
        }
Пример #3
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public NPC()
        {
            // Physics.
            EnablePhysics(PhysicsFlags.Solid | PhysicsFlags.HasGravity);
            Physics.CollisionBox = new Rectangle2F(-8, -11, 16, 13);
            Physics.SoftCollisionBox = new Rectangle2F(-10, -15, 20, 19);

            // Graphics.
            Graphics.DepthLayer	= DepthLayer.PlayerAndNPCs;
            Graphics.DrawOffset = new Point2I(-8, -14);

            // General.
            centerOffset		= Graphics.DrawOffset + new Point2I(8, 8);
            actionAlignDistance	= 5;
            flags				= NPCFlags.FacePlayerOnTalk | NPCFlags.FacePlayerWhenNear;

            message = null;
            animationTalk = null;

            // Bounding box for talking is 4 pixels beyond the hard collision box (inclusive).
            // Alignment limit is a max 5 pixels in either direction (inclusive).
        }
Пример #4
0
 public void DisplayMessage(Message message, Action completeAction)
 {
     PushRoomState(new RoomStateQueue(
         new RoomStateTextReader(message),
         new RoomStateAction(completeAction)));
 }
Пример #5
0
 //-----------------------------------------------------------------------------
 // Text Messages
 //-----------------------------------------------------------------------------
 public void DisplayMessage(Message message)
 {
     PushRoomState(new RoomStateTextReader(message));
 }
 //-----------------------------------------------------------------------------
 // Static Factory Methods
 //-----------------------------------------------------------------------------
 public static RoomEnterExitState CreateEnter(int walkDirection, float walkDistance, Message enterMessage = null)
 {
     return new RoomEnterExitState(EnterExitType.Enter, walkDirection, walkDistance, enterMessage);
 }
 //-----------------------------------------------------------------------------
 // Constructor
 //-----------------------------------------------------------------------------
 private RoomEnterExitState(EnterExitType type, int walkDirection, float walkDistance, Message enterMessage = null)
     : this(type, walkDirection, walkDistance, GameSettings.PLAYER_MOVE_SPEED, enterMessage)
 {
 }