private void Act(Player player, Map map) { Point target = Position; if (GetDistanceToTarget(player.Position, Position) <= visibilityRadius) { if (GetDistanceToTarget(player.Position, Position) > attackRadius) { target = player.Position; } else { TryAttack(player); } } else { if (Position == Trajectory.Peek()) { Trajectory.Enqueue(Trajectory.Dequeue()); } target = Trajectory.Peek(); } var direction = DirectionFinder.FindDirectionToTarget(map, target, Position, Radius); if (direction != Direction.None) { Position = GetNextPosition(direction, Position); MovementTimer.Restart(); } }
public Form1() { InitializeComponent(); MovementTimer.Start(); PictureBox1LOC = pictureBox1.Location; picboundupdate(); SetDoubleBuffered(panel1); }
public void TryAct(Player player, Map map) { if (StopTimer.IsReady) { MovementTimer.Tick(); if (MovementTimer.IsReady) { Act(player, map); } } else { StopTimer.Tick(); } }
public void DoMovementTimer( TimeSpan delay ) { if( m_MovementTimer != null ) m_MovementTimer.Stop(); m_MovementTimer = new MovementTimer( this, delay ); m_MovementTimer.Start(); }
public Mobile( float x, float y, float z, float orient ) : base( Server.Object.GUID++, x, y, z, orient ) { //objectTypeId = 3; if ( !( this is Character ) ) { this.Guid += 0xF000A00000000000; localTime = DateTime.Now.Ticks; movementTimer = new MovementTimer( this ); } else items = new Item[ 104 ]; }
public Mobile() : base( Server.Object.GUID++ ) { if ( this is Corps ) this.Guid += 0xE000A00000000000; if ( this is BaseCreature ) { localTime = DateTime.Now.Ticks; moveVector = new MoveVector( this, X, Y, Z ); aiType = AITypes.Beast; this.Guid += 0xF000A00000000000; movementTimer = new MovementTimer( this ); } else items = new Item[ 104 ]; }
void BeginShift() { if (state != RecordState.Started) { state = RecordState.Started; startTime = DateTime.Now; SendMessage("Logging Initialized @: " + startTime); if (activeLogging) { MovementTimer timer = new MovementTimer(this); lastMousePosition = Cursor.Position; } } else SendMessage("Error: Logging Already in Progress!"); }
public NpcState() { Action = CurrentAction.IdleStanding; _state = new StateTimer(); _movement = new MovementTimer(); }