public bool TryPredictivePush(Vector3Int from, Vector2Int dir, float speed = Single.NaN) { if (isNotPushable || !CanPredictPush || Pushable == null || !isAllowedDir(dir)) { return(false); } lastReliablePos = registerTile.WorldPositionClient; if (from != lastReliablePos) { return(false); } Vector3Int target = from + Vector3Int.RoundToInt(( Vector2 )dir); if (!MatrixManager.IsPassableAt(from, target, isServer: false) || MatrixManager.IsNoGravityAt(target, isServer: false)) //not allowing predictive push into space { return(false); } bool success = Pushable.PredictivePush(target.To2Int(), speed); if (success) { pushPrediction = PushState.InProgress; pushApproval = ApprovalState.None; predictivePushTarget = target; Logger.LogTraceFormat("Started predictive push {0}->{1}", Category.PushPull, from, target); } return(success); }
private bool TryPredictiveFollow(Vector3Int from, Vector3Int target, float speed = Single.NaN) { if (!IsBeingPulledClient || isNotPushable || Pushable == null) { return(false); } bool success = Pushable.PredictivePush(target.To2Int(), speed, true); if (success) { // Logger.LogTraceFormat( "Started predictive follow {0}->{1}", Category.PushPull, from, target ); } return(success); }
private bool TryPredictiveFollow(Vector3Int from, Vector3Int target, float speed = Single.NaN) { if (!IsBeingPulledClient || isNotPushable || Pushable == null) { return(false); } // Vector3Int target = from + Vector3Int.RoundToInt( ( Vector2 ) dir ); // if ( !MatrixManager.IsPassableAt( from, target, false ) // ) { // return false; // } bool success = Pushable.PredictivePush(target.To2Int(), speed, true); if (success) { // Logger.LogTraceFormat( "Started predictive follow {0}->{1}", Category.PushPull, from, target ); } return(success); }