private void AddMoveToTick() { var actionChain = new ActionChain(); actionChain.AddDelaySeconds(monsterTickInterval); actionChain.AddAction(this, () => { if (!IsDead && PhysicsObj?.MovementManager?.MoveToManager != null && PhysicsObj.IsMovingTo()) { PhysicsObj.update_object(); UpdatePosition_SyncLocation(); SendUpdatePosition(); if (PhysicsObj?.MovementManager?.MoveToManager?.FailProgressCount < 5) { AddMoveToTick(); } else { if (PhysicsObj?.MovementManager?.MoveToManager != null) { PhysicsObj.MovementManager.MoveToManager.CancelMoveTo(WeenieError.ActionCancelled); PhysicsObj.MovementManager.MoveToManager.FailProgressCount = 0; } EnqueueBroadcastMotion(new Motion(CurrentMotionState.Stance, MotionCommand.Ready)); } //Console.WriteLine($"{Name}.Position: {Location}"); } }); actionChain.EnqueueChain(); }
private void AddMoveToTick() { var actionChain = new ActionChain(); actionChain.AddDelaySeconds(monsterTickInterval); actionChain.AddAction(this, () => { if (!IsDead && PhysicsObj.IsMovingTo()) { PhysicsObj.update_object(); UpdatePosition_SyncLocation(); SendUpdatePosition(); AddMoveToTick(); //Console.WriteLine($"{Name}.Position: {Location}"); } }); actionChain.EnqueueChain(); }
private void AddMoveToTick() { var actionChain = new ActionChain(); actionChain.AddDelaySeconds(monsterTickInterval); actionChain.AddAction(this, () => { if (!IsDead && PhysicsObj?.MovementManager?.MoveToManager != null && PhysicsObj.IsMovingTo()) { PhysicsObj.update_object(); UpdatePosition_SyncLocation(); SendUpdatePosition(); if (PhysicsObj?.MovementManager?.MoveToManager?.FailProgressCount < 10) { AddMoveToTick(); } //Console.WriteLine($"{Name}.Position: {Location}"); } }); actionChain.EnqueueChain(); }