private MonsterMoveInfo GetMovementInfo(MonsterMoveStatus type) { Monster.Direction = (short)GetRotation(Monster.Destination); MonsterMoveInfo i = new MonsterMoveInfo { CurrentPosition = Monster.Position, Destination = Monster.Destination, Rotation = Monster.Direction, Status = type }; return(i); }
private void ReturnToSpawnLocation() { Monster.Target = null; Monster.Destination = new Position(Monster.SpawnX, Monster.SpawnY, 0); Monster.Movement.MoveTo(Monster.Destination); Monster.IsMoving = true; Monster.Attacking = false; MonsterMoveInfo start = GetMovementInfo(MonsterMoveStatus.StartMoving); if (MonsterMove != null) { MonsterMove(this, new MonsterMoveInfoEventArgs(start)); } }
public MonsterMoveInfoEventArgs(MonsterMoveInfo i) { this.info = i; }
private void UpdateMovement() { if (Monster.Position != Monster.Destination) { byte state = Monster.Movement.Update(); switch (state) { case 0: MonsterMoveInfo start = GetMovementInfo(MonsterMoveStatus.StartMoving); if (MonsterMove != null) { MonsterMove(this, new MonsterMoveInfoEventArgs(start)); } break; case 1: //if (state == MonsterAIState.Chase) //{ // if (Monster.Target.Position != Monster.Destination) // { // StopMoving(); // MoveTo(Monster.Target.Position); // } //} MonsterMoveInfo keep = GetMovementInfo(MonsterMoveStatus.KeepMoving); if (MonsterMove != null) { MonsterMove(this, new MonsterMoveInfoEventArgs(keep)); } break; case 2: Monster.IsMoving = false; MonsterMoveInfo stop = GetMovementInfo(MonsterMoveStatus.StopMoving); if (MonsterMove != null) { MonsterMove(this, new MonsterMoveInfoEventArgs(stop)); } Monster.LastMoveTime = DateTime.Now; break; } //if (Monster.Movement.Update()) //{ // Monster.IsMoving = false; // MonsterMoveInfo stop = GetMovementInfo(MonsterMoveStatus.StopMoving); // if (MonsterMove != null) // MonsterMove(this, new MonsterMoveInfoEventArgs(stop)); // Monster.LastMoveTime = DateTime.Now; //} //else //{ // //if (state == MonsterAIState.Chase) // //{ // // if (Monster.Target.Position != Monster.Destination) // // { // // StopMoving(); // // MoveTo(Monster.Target.Position); // // } // //} // MonsterMoveInfo keep = GetMovementInfo(MonsterMoveStatus.KeepMoving); // if (MonsterMove != null) // MonsterMove(this, new MonsterMoveInfoEventArgs(keep)); //} } else { Monster.IsMoving = false; MonsterMoveInfo stop = GetMovementInfo(MonsterMoveStatus.StopMoving); if (MonsterMove != null) { MonsterMove(this, new MonsterMoveInfoEventArgs(stop)); } Monster.LastMoveTime = DateTime.Now; } }